Hi everybody, i'm trying to save all the dates from temp directory to compare after and if is necessary delete some of them, but i'm not really an expert about batch, and i can't save the file date..what's the problem???
ty for your time,ZTB.
@echo off
setlocal ENABLEEXTENSIONS
PUSHD %jboss_home%\server\default\tmp
echo %CD%
FOR %%x in (*) DO (echo %%~tx
set tomate=%%~tx
echo %tomate%)
the result:
D:\jboss-6.1.0.Final\server\default\tmp
03/07/2012 13:49
%tomate%--->why i can't see the file date?
save files date to compare and delete
Moderator: DosItHelp
Re: save files date to compare and delete
You need to process it in the loop or use delayed expansion.
Re: save files date to compare and delete
what do you mean?? i'm totally nerd..can you explain with and example?
ty.
ZTB
ty.
ZTB
Re: save files date to compare and delete
Well...i have searching....so i decided (by myself :O) to modify script ..but sth is wrong..
anyone have a possible solution..i paid for it with and smile..what is wrong here??
@echo off
setlocal ENABLEDELAYEDEXPANSION
PUSHD %jboss_home%\server\default\tmp
echo %CD%
set COUNT=%DATE% o
FOR %%x in (*) DO (echo %%~tx
echo !COUNT!
set /A COUNT=%%~tx---> :_(
echo !COUNT!
)
ty.
anyone have a possible solution..i paid for it with and smile..what is wrong here??
@echo off
setlocal ENABLEDELAYEDEXPANSION
PUSHD %jboss_home%\server\default\tmp
echo %CD%
set COUNT=%DATE% o
FOR %%x in (*) DO (echo %%~tx
echo !COUNT!
set /A COUNT=%%~tx---> :_(
echo !COUNT!
)
ty.
Re: save files date to compare and delete
OH yeah!!! if sb needs there is! 
for %%Q IN (*.*) DO (
set FILETIME=%%~tQ
set PEPE=%%~tQ
echo *************************************************************
echo nombre del fichero:%%Q
echo fecha del fichero:%%~tQ
echo fecha del fichero formatada:%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
echo fecha del fichero formatada:!PEPE:~6,4!!PEPE:~3,2!!PEPE:~0,2! REM YYYYMMDD!!!!
echo !PEPE!
echo fecha para comparar:%dataComparar2%
echo *************************************************************
)

for %%Q IN (*.*) DO (
set FILETIME=%%~tQ
set PEPE=%%~tQ
echo *************************************************************
echo nombre del fichero:%%Q
echo fecha del fichero:%%~tQ
echo fecha del fichero formatada:%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
echo fecha del fichero formatada:!PEPE:~6,4!!PEPE:~3,2!!PEPE:~0,2! REM YYYYMMDD!!!!
echo !PEPE!
echo fecha para comparar:%dataComparar2%
echo *************************************************************
)