irishmanjb
asked on
FORFILES SYNTAX
I am trying to remove all zip files from the F:\ACT\ACT-Offsitebkp directory on my server that are greater than 2 days old. I cannot seem to get this to work on my server. It works locally when I test it and the directory is c:\ACT\ACT-offsitebkp\
Forfiles -pf:\ACT\ACT-offsitebkp\ *.zip -d-2 -c"CMD /C del @FILE"
I think I am missing something small any help would be appreciated
Thanks
Forfiles -pf:\ACT\ACT-offsitebkp\ *.zip -d-2 -c"CMD /C del @FILE"
I think I am missing something small any help would be appreciated
Thanks
ASKER
Sorry I am getting invalid switch -pf
http://www.ss64.com/nt/forfiles.html
have you tried Forfiles -pf:\ACT\ACT-offsitebkp\ -m*.zip -d-2 -c"CMD /C del @FILE"
assuming that F:\ACT\ACT-offsitebkp\ exists
Regards,
have you tried Forfiles -pf:\ACT\ACT-offsitebkp\ -m*.zip -d-2 -c"CMD /C del @FILE"
assuming that F:\ACT\ACT-offsitebkp\ exists
Regards,
ASKER
I tried again and keep getting Invalid argument option' -pf\ACT\ACT-offsitebkp\ -m*.zip -d-2 -c"CMD /C del @FILE"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I had the same issue - worked on XP Prof but not on windows 2003 - and found that if I put a space between the switch and variable it worked ok on windows 2003.
EG: -
-p f:\ACT\ACT-offsitebkp\ -m *.zip -d -2 -c "CMD /C del @FILE"
cheers
EG: -
-p f:\ACT\ACT-offsitebkp\ -m *.zip -d -2 -c "CMD /C del @FILE"
cheers
e.g.
C:\Program Files\someotherfoldernames
You didn't state the error you got, so I'm just assuming the basics.
Regards,