[THIN] Script to delete files/folders older than x days

  • From: Angela Smith <angela_smith9@xxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Mon, 19 Mar 2012 19:02:31 +1100

Hi 



Im looking at running
a script from my Citrix servers via a scheduled task that deletes files and
folders older than 1 day.  Has anyone used such a script before?  I
was looking at forfiles but I cant work out the syntax to delete files and
folders in 1 line.  I run the following which works but I would
prefer to run it off 1 line as I have many paths to check 



FORFILES /P
"L:\PATH" /S /M *.* /D -1 /C "cmd /c del "@file"
/q" >>D:\Log.txt 

FORFILES /P
"L:\PATH"  /D -1 /C "CMD /C if @ISDIR==TRUE echo RD /S /Q
@FILE &RD /S /Q @FILE" >>D:\Log.txt 





Any assistance
appreciated





Thanks 

Ang

                                          

Other related posts: