Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't delete files from folder

Status
Not open for further replies.

ChefSausage

Programmer
Oct 19, 2002
36
US
I'm receiving a very strange error when trying to delete files from a certain folder.

On a template called purgefiles.asp, I have a line of code to delete everything from a folder:

fs.DeleteFile("w:\inetpub\
However, when I execute purgefiles.asp in the browser, I get this error:

Microsoft VBScript runtime error '800a0035'
File not found
/fairlook_test/purgefiles.asp, line 49

Now, line 49 contains the aforementioned delete command, but why is it saying that it cannot find a template that it's not supposed to delete in the first place?
 
oops pressed enter too soon there

Off the top of my head what you could do is run thru a loop passing the names into the line like (but I'm not entirely sure on this)

for i =1 to 10
objFS.DeleteFile (fname(i))
next



 
You can't? I read on an online ASP site that wildcards were allowed in such a statement. How else could you delete the entire contents of a folder without creating an array of all the filenames, then deleting them?
 
Make sure you have at least one file in that folder that matches *.png, otherwise you will get a file not found error. Seems a little odd to me that you can delete with wildcards, but only if at least one file matches that wildcard expression :p

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top