Solved

VBScript to delete a list of files from sub directories

Posted on 2007-03-22
3
221 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.

776 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