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.
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?
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