locked
Script to delete old backups RRS feed

  • Question

  • I'm trying to create a script which will erase backups which are older than x days old. I have the following script; the first line seems to run ok but when running the second line I get the error " Invalid argument/option- '@isdir==TRUE'"

    forfiles /P D:\Previous\ /S /M *.* /D -16 /C "cmd /c del @PATH"
    forfiles -p "D:\Previous\" -d -16 -c "cmd /c IF @isdir==TRUE rd /S /Q @path"
    

    Any help is greatly appreciated

    Thanks

    Friday, April 3, 2015 5:06 PM

Answers

  • Try this:

    forfiles /p "D:\Previous" -d -16 -c "cmd /c IF @isdir==TRUE rd /S /Q @path"

    • Marked as answer by KieranSto_ Friday, April 3, 2015 9:02 PM
    Friday, April 3, 2015 5:36 PM