Jump to content

Recommended Posts

Posted

Hi i am trying to write a script using forfiles to delete some files older than 5 days, list what i have delted and output it to a file. but it dosent seem to work here is what i am using.

 

forfiles /p c:\windows\system32\logfiles /s /d-5 /c "cmd /c echo @patH @filE & cmd /c del @file" > c:gill-delte.txt

 

 

Im not any good at this so any help would be gratefully received.

thanks in advance

Posted

I'd expect that output to come from the del command itself and then you are piping it to a txt file.

 

Not near a pc at the moment so can't test.

 

Ben

  • 4 months later...
Posted

Hi,

I want to delete all directories whose name starts with abc and are x days old. I am using forfiles as below but not getting output. Please help :

forfiles /p location /m abc* /d -x /c "cmd /c IF @isdir == TRUE rd /Q @path"

forfiles /p location /m abc.* /d -x /c "cmd /c IF @isdir == TRUE rd /Q @path"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...