Solved

Windows Batch Script to Search Network Drive Directorys

Posted on 2009-05-12
2
260 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 250 total points
Comment Utility
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
Comment Utility
Jonah, that gives me something to work with which I wasn't aware existed so thanks for the lead!!!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

762 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

8 Experts available now in Live!

Get 1:1 Help Now