1.

Solve : Bat script Delete any File Not Created Today?

Answer»

I'm having difficulty removing the time from the date modified date. The date modified displays like so... 07/12/2014 03:27 PM. I tried numerous things but no LUCK any help would be great.

Its currently showing...
07/17/2014 03:27 PM NEQ 07/17/2014
but i need it to be this...
07/17/2014 NEQ 07/17/2014

thanks!

Code: [Select]ECHO On
set currentDate=%date:~4,2%/%date:~7,2%/%date:~10,4%
set File="C:\TEST\*.txt"


FOR %%? IN (%File%) DO (
ECHO Last-Modified Date : %%~t?
echo FileName : %%?
echo %currentDate%
ECHO %%~t?
IF %%~t? NEQ %currentDate% DEL "%%?"
)
PAUSE


Your explanation SAYS date modified but the title implies CREATION date

Which is it?  And are the files in a single folder?  Is it for more than say 50 files at a time?  Which OS is it for?try this:
Code: [Select]ECHO On
set currentDate=%date:~4,2%/%date:~7,2%/%date:~10,4%
set File="C:\Test\*.txt"


FOR %%? IN (%File%) DO (
ECHO Last-Modified Date : %%~t?
echo FileName : %%?
echo %currentDate%
ECHO %%~t?
for /f "tokens=1 delims= " %%A in ("%%~t?") do (
IF %%A NEQ %currentDate% DEL "%%?"
)
)
PAUSEThat worked  Lemonilla thank you very MUCH



Discussion

No Comment Found