Kwt712
535 pts. | Aug 26 2009 3:37PM GMT
Great, it worked thanks for the help. I do have one question. Is there a way to download ForFiles to make it work on WinXP Professional SP2. I cannot have the same script work off of my desktop. Any recommendations.
Thanks
Kwt712
535 pts. | Aug 26 2009 3:59PM GMT
ok, i have a problem now, i just put this on a production server
Windows 2003 SP2 … this is what i am getting now when i run a script against the foler
C:Batch File>ECHO ***** Files1F:userDischarge forms - savedCompleted *****
***** Files1F:userDischarge forms - savedCompleted *****
C:Batch File>ECHO ***** DELETING FILES *****
***** DELETING FILES *****
C:Batch File>forfiles /p “F:userDischarge forms - savedtest” /s /m *.* /d -
25 /c “cmd /c del @file”
ERROR: Invalid argument/option - ‘@file’.
Type “FORFILES /?” for usage.
C:Batch File>pause
Press any key to continue . . .
I have 2 folders one is completed that the script will run against and the other one is test with same files in them. I have files dated 7/11/2009 and the script will not clean them up. where did i go wrong here now.
thanks
Carlosdl
29855 pts. | Aug 26 2009 4:52PM GMT
Can you post the contents of your script file ? (not the results when running it)
Thanks,
Kwt712
535 pts. | Aug 26 2009 5:13PM GMT
here you go
ECHO ***** Files1F:userDischarge forms - savedCompleted *****
ECHO ***** DELETING FILES *****
forfiles /p “F:userDischarge forms - savedtest” /s /m *.* /d -25 /c “cmd /c del @file”
pause
ALSO, is it possible to make ForFiles to work with XP. If yes, then how.
Thanks
Carlosdl
29855 pts. | Aug 26 2009 6:17PM GMT
The problem seems to be the double quotes (”) in the path.
You could try changing directory first, and then executing forfiles.
Something like this:
F: cd “F:userDischarge forms - savedtest” forfiles /s /m *.* /d -25 /c “cmd /c del @file”
Carlosdl
29855 pts. | Aug 26 2009 6:44PM GMT
There is a version you can download that runs on XP, but it is not the same version as the one included in Server 2003 or 2008, and the syntax is not the same.
You can download it from here.
Basically, you use “-” instead of “/” to specify the parameters, and you can’t have blank spaces between the parameter option and the parameter itself. The @file variable must be in Uppercase.
You would need to change your script to something like this:
cd “F:userDischarge forms - savedtest” forfiles -s -m*.* -d-25 -c”cmd /c del @FILE”
Kwt712
535 pts. | Aug 26 2009 6:48PM GMT
The ForFiles for Windows XP. It is only 12kb. Does that file needs to be in a certain directory for it to work.
thanks
Carlosdl
29855 pts. | Aug 26 2009 7:42PM GMT
Yes, it is a small program.
It should be in a directory included in your PATH environment variable, for example “C:windowssystem32″
Kwt712
535 pts. | Aug 27 2009 12:50PM GMT
can you tell me where exactly i need to put this file, i already copy it in C:windowssystem32 folder. Let me know.
thanks
Carlosdl
29855 pts. | Aug 27 2009 2:38PM GMT
and … did it work ?
You can put it wherever you want, but you have to make sure that path is included in your PATH environment variable.
Kwt712
535 pts. | Aug 27 2009 3:14PM GMT
ok let me get this straight … under Environment Variable, i have a User Variables and System Variables … i am guessing that the forfiles will be under user variables as C:windowssystem32forfiles.exe
let me know if i have this right.
thanks






