Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FORFILES SYNTAX

Posted on 2006-06-20
6
Medium Priority
?
1,801 Views
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

Thanks

0
Comment
Question by:irishmanjb
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

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

e.g.

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.

Regards,
0
 

Author Comment

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

Expert Comment

by:ECNSSMT
ID: 16944656
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,
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

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

Accepted Solution

by:
ECNSSMT earned 400 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.  

Regards,
0
 

Expert Comment

by:GENINZ
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"

cheers
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

926 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