Could anyone help with this one...
I want to create a batch script which goes into a directory and checks if any files in that directory are older than yesterdays date. If any files are, then delete them.
When you are the IT director, it's your job to make sure the IT works. If it does work they know already and if it doesn't, they don't want to hear your pathetic excuses.
is it not possible to have a script which should work for 2 different conditions?
like;
-----------------------------------------------------------
@ECHO OFF
IF "%DAY%" == "Monday" GOTO FIRST
:SECOND
forfiles /p d:\FTPData /s /m *.* /d -5 /c "cmd /c del @file : date >= 4 days > NUL"
:FIRST
forfiles /p d:\FTPData /s /m *.* /d -3 /c "cmd /c del @file : date >= 2 days > NUL"
----------------------------------------------------------
a bit strange happens because it jumps to :FIRST even though it's not monday
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.