1.

Solve : Can I use FORFILES to remove folders of files??

Answer»

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)
Code: [Select]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..

Quote from: BAM01 on June 24, 2009, 01:53:34 PM

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:\>Quote from: billrich on August 23, 2009, 08:26:50 AM
C:\>rmdir /?
Removes (deletes) a directory.
it just removes directory, but does not check for X days to delete. extra code is needed.


Discussion

No Comment Found