Batch File - Check Folder Date

Associate
Joined
7 Jul 2009
Posts
2,389
Location
Wiltshire
Hi & Good Afternoon,

I need a little help....

What is the easiest way to check a folder date through a batch file?

I need the batch file to run and check and delete a folder with yesterdays date. The folders name will be that date (2013-07-09), once it's found, delete it.

Any thoughts and suggestions most welcome.

Thanks & Regards
 
Associate
Joined
20 Mar 2009
Posts
162
Location
Leeds
Code:
@echo off
echo wscript.Echo dateadd("d", -1, now()) > "%temp%\yesterday.vbs"
for /F %%a in ('cscript //nologo "%temp%\yesterday.vbs"') do set yesterday=%%a
set yesterday_folder=%yesterday:~6,4%-%yesterday:~3,2%-%yesterday:~0,2%
rmdir /s /q %yesterday_folder%
 
Back
Top Bottom