Computer Hope
Microsoft => Microsoft DOS => Topic started by: JTS on June 15, 2009, 12:15:35 PM
-
I have a backup script that places the backup file into a current date folder. I want to use a script to say truncate all folders that are earlier than 30 days from today's date
I do have a FORFILES script but it appears it is for files only. Is there a syntax to delete groups of folders based on the file system create date?
Thanks
-
"FORFILES script" is not a specific description., but Google found :-
http://www.pcreview.co.uk/forums/thread-1466456.php
That was posted by someone who wished to avoid the default action of deleting Folders as well as files - i.e. he did not like the default which you seem to require.
Regards
Alan
-
Ok then what DOS command would I use to delete folders with files after x given days...
-
if its possible, you can download findutils (see my sig), and use the find command (different from Windows own find command)
c:\test> find c:\test -type f -mtime +1 -delete
the above delete files more than 1 day old. adjust as needed.
-
BAM01 gave me this..
Haven't tried this yet but it's supposed to move files to a second folder if they are 365 days old
forfiles /p E:\path /m *.* /d -365 /c "cmd /c move @file e:\DELETE.FILES"
Will try it out.
-
C:\>rmdir /?
Removes (deletes) a directory.
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
C:\>
-
C:\>rmdir /?
Removes (deletes) a directory.
it just removes directory, but does not check for X days to delete. extra code is needed.