Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
I have been using a batch file to delete .zip files in a directory that are older than 2 days old. It has been working very well. However, I would like to modify it so it will delete files older than 5 days old. I really don't understand what this batch file is saying, all I know is that it is working. Could someone help me read this batch file and change it to delete files older than 5 days?
setlocal enabledelayedexpansion set ftsw=Y for /f "tokens=* delims=*" %%v in ('dir /tw /o-d /b /s C:\DBBackup\*Backup.zip') do ( if !ftsw!==N del "%%v" call set ftsw=N ) exit
Name: Razor2.3 Date: August 6, 2009 at 05:54:10 Pacific
Reply:
I have been using a batch file to delete .zip files in a directory that are older than 2 days old. No, it doesn't. It deletes every *Backup.zip, excluding the most current file.
0
Response Number 2
Name: amiller Date: August 6, 2009 at 07:46:31 Pacific
Reply:
I just tested it, it didnt delete all .zip files. kept the most recent one. seems to work for me. I just wish i could understand what the code means. Thanks for your help anyways.
0
Response Number 3
Name: Razor2.3 Date: August 6, 2009 at 08:12:11 Pacific
Reply:
amiller:it didnt delete all .zip files. kept the most recent one. Yes, that's what excluding means.
Summary: Hi I am trying to get a batch file to delete files which has dates older than 7 days so far I have @ECHO OFF CLS FOR /R C:\User_share %%FILE IN (*.*) DO ( ECHO starting if IF(0 == (ISDATE %%~zFILE bef...
Summary: I need to count the number of files in a directory. I used the following DOS Prompts-- Go to respective folder-- Set Count=0 ....... Dir * If not ErrorLevel 1 Set /A Count=%Count%+1 ....... Echo %Coun...
Summary: Hi , I am using the following command in my batch file to find no of batch files in a directory dir "a\b\c" | find /v /c "::" I am able to get the count,but i dont know whow to store it in a variable....