Solved

VBScript to delete a list of files from sub directories

Posted on 2007-03-22
3
224 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
[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
  • 2
3 Comments
 
LVL 71

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 71

Expert Comment

by:Chris Dent
ID: 18850334

No problem :)

Chris
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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 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 …

749 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