Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FORFILES SYNTAX

Posted on 2006-06-20
6
Medium Priority
?
1,798 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

670 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