0

Followed the question: https://stackoverflow.com/search?q=Batch+file+to+delete+files+older+than+N+days -

I changed it in order to work in another machine that has windows XP:

forfiles -p"%%~a" -s -m*.* -d%days% -c"cmd /c if /i @isdir==true echo Deleting... @path & echo @path>>C:\Jobfolder\Folders_that_deleted.txt & rd /s /q @path"

and it is not working.

Community
  • 1
  • 1
YWATFA
  • 91
  • 1
  • 2
  • 9
  • 1
    `it is not working` is a bit vague. It results into a shutdown, a bluescreen, it does nothing or what? – jeb Feb 04 '15 at 11:11
  • Yes It does nothing. My script is just two loops. The 'forfiles' is inside 'for'. As I said above... I copied the 'forfiles.exe' to C:\windows\system32 in the OLD machine that have windows XP. The syntax of the (XP forfiles) I took from this site from the qestion: "Batch file to delete files older than N days" as I mentioned. I appreciated your help! Thanks. – YWATFA Feb 04 '15 at 14:42
  • forfiles -p[path] -s -m*.* -c"CMD /C if @ISDIR==TRUE echo Deleting...@PATH & echo @PATH>>C:\Jobfolder\Folders_that_deleted.txt & rd /s /q @PATH" -d%days% - This is the correct syntax. and the problem solved. Thanks. – YWATFA Feb 05 '15 at 21:32

1 Answers1

1

(Answered in the comments and question edit. Converted to a community wiki answer. See What is the appropriate action when the answer to a question is added to the question itself? )

The OP wrote:

I downloaded Forfiles.exe from that link and copied it to C:\windows\system32. my forfiles is (it works perfect in Windows 7):

forfiles /p "%%~a" /d %days% /c "cmd /c if /i @isdir==true echo Deleting... @path & echo @path>>C:\Jobfolder\Folders_that_deleted.txt & rd /s /q @path"
Community
  • 1
  • 1
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129