Jump to content

Delete Files Older Than x Days - ForFiles.exe - Script Issues


Recommended Posts

Posted

Hi,

 

I'm having a little issue with a batch script that I've managed to create, using information from various posts and forums on the web but can't quite get it right.

 

Can anyone offer any help?

 

I'm wanting the script to check a folders contents by the age and delete anything over 5 days old, the script I have at the minute is as follows:

 

forfiles /p "Insert Directory Within the quotation marks" /s /D -10 /M *.* /C "cmd /C del @path /Q"

Posted

Here's a line from one of my scripts, that's working fine :-

 

forfiles /P Z: /M "*.BKF" /D -21 /C "CMD /C DEL @FILE"

 

Z: is the path

*.BKF is the 'mask' -

-21 - 3 weeks is what we're keeping in this case.

 

Hope this is of some use.

  • Thanks 1
Posted
Here's a line from one of my scripts, that's working fine :-

 

forfiles /P Z: /M "*.BKF" /D -21 /C "CMD /C DEL @FILE"

 

Z: is the path

*.BKF is the 'mask' -

-21 - 3 weeks is what we're keeping in this case.

 

Hope this is of some use.

 

Cheers for that :)

 

Managed to get it working with a VBS now though

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...