Posted on 2006-06-20
Last Modified: 2013-12-28
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


Question by:irishmanjb
  • 3
  • 2
LVL 14

Expert Comment

ID: 16943090
just for laughs, include the path to Forfiles


C:\Program Files\someotherfoldernames\Forfiles -pf:\ACT\ACT-offsitebkp\ *.zip -d-2 -c"CMD /C del @FILE"

You didn't state the error you got, so I'm just assuming the basics.


Author Comment

ID: 16944481
Sorry I am getting invalid switch -pf
LVL 14

Expert Comment

ID: 16944656

have you tried Forfiles -pf:\ACT\ACT-offsitebkp\  -m*.zip -d-2  -c"CMD /C del @FILE"

assuming that F:\ACT\ACT-offsitebkp\ exists

Do email signature updates give you a headache?

Are you constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.


Author Comment

ID: 16954595
I tried again and keep getting Invalid argument option' -pf\ACT\ACT-offsitebkp\  -m*.zip -d-2  -c"CMD /C del @FILE"
LVL 14

Accepted Solution

ECNSSMT earned 100 total points
ID: 16976603
if its not because of a typo -pf\ACT\ACT-offsitebkp\  -m*.zip -d-2  -c"CMD /C del @FILE"
instead of -pf:\ACT\ACT-offsitebkp\  -m*.zip -d-2  -c"CMD /C del @FILE"

do a Forfiles ? to see the options presented by this version of Forfiles.  


Expert Comment

ID: 32683458
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"


Featured Post

Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now