Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Deleting files and folders.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61935
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Deleting files and folders.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Deleting files and folders. - 6/27/2008 9:55:48 AM   
  jcarver_14

 

Posts: 31
Score: 0
Joined: 6/4/2008
From: Cincinnati
Status: offline
Hey I got a problem deleting files.  I wrote a script to delete files, heres how it works...

It reads a txt file that contains a folder path in each line then attemps to delete the files in the folder.  It works great wtih the exception of files that the name is to long.  It just skips these like they dont exist.  Also even though I have on error resume next enabled it wants to loop into its self forcing the script to never end.

Any ideas on how to fix this... heres what I have so far.



      
 
 
Post #: 1
 
 RE: Deleting files and folders. - 7/1/2008 4:02:49 PM   
  djredmar


Posts: 61
Score: 0
Joined: 12/11/2006
From: Europe, The Netherlands
Status: offline
quote:

ORIGINAL: jcarver_14

Hey I got a problem deleting files.  I wrote a script to delete files, heres how it works...

It reads a txt file that contains a folder path in each line then attemps to delete the files in the folder.  It works great wtih the exception of files that the name is to long.  It just skips these like they dont exist.  Also even though I have on error resume next enabled it wants to loop into its self forcing the script to never end.

Any ideas on how to fix this... heres what I have so far.



      


Those Files are maybe in use?

Try to debug with wscript.echo, why use on error resume next and not if file.count?

Can you post the contents of the txt file? maybe quotes are needed for the nextline string?


(in reply to jcarver_14)
 
 
Post #: 2
 
 RE: Deleting files and folders. - 7/1/2008 6:54:40 PM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
How about something like this? 
Granted, it doesn't have any error-checking to speak of, and there are some instances where a file or folder might get left behind, but for vanilla use, where you have already made sure that the files/folders aren't in use, it should work/give you a starting point.  It'll delete any files in the targetted folder, along with any subfolders (and their contents) as well.


      



_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to djredmar)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Deleting files and folders. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts