Solved

VBScript to delete a list of files from sub directories

Posted on 2007-03-22
3
215 Views
Last Modified: 2010-04-16
I need a VBScript to delete a list of paths and files from the current directory. The list of files is located on C:\files.txt. The current can be any directory. Every file in the list is in a sub directory of the current directory: File example:

copenhagen/hotels/images/4.jpg
copenhagen/hotels/images/6.jpg
copenhagen/hotels/images/7.jpg
copenhagen/hotels/images/8.jpg
copenhagen/hotels/images/9.jpg
copenhagen/hotels/images/breakfast_room_icon.gif
copenhagen/hotels/images/index_clip_image002.jpg
copenhagen/hotels/images/index_clip_image003.jpg
copenhagen/hotels/images/index_clip_image004.jpg
copenhagen/hotels/images/index_clip_image006.gif
copenhagen/hotels/images/index_clip_image006_0000.gif
copenhagen/hotels/images/index_clip_image006_0001.gif
copenhagen/hotels/images/index_clip_image006_0002.gif
copenhagen/hotels/images/index_clip_image006_0003.gif
copenhagen/hotels/images/index_clip_image006_0004.gif
copenhagen/hotels/images/index_clip_image006_0005.gif
copenhagen/hotels/images/index_clip_image007.gif
copenhagen/hotels/images/index_clip_image007_0000.gif
copenhagen/hotels/images/index_clip_image007_0001.gif
copenhagen/hotels/images/index_clip_image007_0002.gif
copenhagen/hotels/images/index_clip_image007_0003.gif
copenhagen/hotels/images/index_clip_image007_0004.gif
copenhagen/hotels/images/index_clip_image007_0005.gif
copenhagen/hotels/images/index_clip_image007_0006.gif
copenhagen/hotels/images/index_clip_image008.gif
copenhagen/hotels/images/index_clip_image008_0000.gif
copenhagen/hotels/images/index_clip_image008_0001.gif
copenhagen/hotels/images/index_clip_image008_0002.gif
copenhagen/hotels/images/index_clip_image008_0003.gif
copenhagen/hotels/images/index_clip_image008_0004.gif
copenhagen/hotels/images/index_clip_image008_0005.gif
copenhagen/hotels/images/index_clip_image010.jpg
copenhagen/hotels/images/index_clip_image011.jpg
copenhagen/hotels/images/index_clip_image012.jpg
copenhagen/hotels/images/index_clip_image013.gif
copenhagen/hotels/images/index_clip_image013_0000.gif
copenhagen/hotels/images/index_clip_image013_0001.gif
copenhagen/hotels/images/index_clip_image013_0002.gif
copenhagen/hotels/images/index_clip_image014.gif
copenhagen/hotels/images/index_clip_image014_0000.gif
copenhagen/hotels/images/index_clip_image014_0001.gif
copenhagen/hotels/images/index_clip_image014_0002.gif
copenhagen/hotels/images/index_clip_image016.jpg
copenhagen/hotels/images/index_clip_image017.jpg
copenhagen/hotels/images/index_clip_image018.jpg
copenhagen/hotels/images/index_clip_image019.gif
copenhagen/hotels/images/index_clip_image020.jpg
copenhagen/hotels/images/index_clip_image021.jpg
copenhagen/hotels/images/index_clip_image022.jpg
copenhagen/hotels/images/index_clip_image023.jpg
copenhagen/hotels/images/index_clip_image025.jpg
copenhagen/hotels/images/index_clip_image026.jpg
copenhagen/hotels/images/index_clip_image027.jpg
copenhagen/hotels/images/index_clip_image029.jpg
copenhagen/hotels/images/index_clip_image030.jpg
copenhagen/hotels/images/index_clip_image031.jpg
copenhagen/hotels/images/index_clip_image032.gif
copenhagen/hotels/images/index_clip_image034.jpg
copenhagen/hotels/images/index_clip_image035.jpg
copenhagen/hotels/images/index_clip_image036.jpg
copenhagen/hotels/images/index_clip_image037.gif
copenhagen/hotels/images/index_clip_image037_0000.gif
copenhagen/hotels/images/index_clip_image039.jpg
copenhagen/hotels/images/index_clip_image040.jpg
copenhagen/hotels/images/index_clip_image041.jpg
copenhagen/hotels/images/lift_icon.gif

Yes I am deleting certain orphaned files from a website :-D

Thanks,

Lee.
0
Comment
Question by:LeeGolding
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 18770299

Just curious... but can't you just throw those all in a batch file, get to the directory above copenhagen and off you go?

It just seems like overkill writing it into VbScript.

Chris
0
 

Author Comment

by:LeeGolding
ID: 18850301
Yes I didn't see that. Doh!

Thanks :-D

Lee.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 18850334

No problem :)

Chris
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 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

17 Experts available now in Live!

Get 1:1 Help Now