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

x
?
Solved

Windows Batch Script to Search Network Drive Directorys

Posted on 2009-05-12
2
Medium Priority
?
280 Views
Last Modified: 2012-05-06
I need to run a script which will delete files/directorys within a subfolder structure only if certain directorys exist.  Then delete the files/directorys which are older that a)7 days.

Parent directory (p:\*fund*\) could be any directory name, for example:
p:\abc\letters\reject\
p:\def\letters\printed\
p:\ghi\letters\

So in above scenario, need to search the root directory (p:\*.*\letters\) for directorys called either reject or printed, then if exist delete the file contents of reject or printed if those files are > than 7 days old.

I've been investigating the CLI in XP and don't think the 'For' or 'If' combined with 'Forfiles' commands can do this.  Do I need to look at a more powerful scripting language?

Any help would be apprciated!!

Thanks in advance.
0
Comment
Question by:Rich55555
2 Comments
 
LVL 7

Accepted Solution

by:
Jonah11 earned 1000 total points
ID: 24370645
This is probably possible, but fwiw I think windows batch is a really unintuitive and un-userfriendly scripting language.  I would look into autoIt or AHK for tasks like these, or even WSH (which can be used with both VB and Javascript, if you happen to know those).  All of these are easy to learn and much more powerful than windows batch.
0
 

Author Closing Comment

by:Rich55555
ID: 31580799
Jonah, that gives me something to work with which I wasn't aware existed so thanks for the lead!!!
0

Featured Post

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.

Question has a verified solution.

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

Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

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