Link to home
Start Free TrialLog in
Avatar of kmorris1186
kmorris1186

asked on

Question about deleting files

Is there any other way to delete a file other then using a FSO or the Kill method?

I have a computer that connectes to remote machines, and deletes files out of a specified folder if it is older then 5 days.  Everything works great, except i receive this error about half of the time:

Runtime error: -2147024832  Description: Method '~' of object '~' failed.

I seem to get it on any number of machines (there is 12 machines that i delete from).  I know it is not a hardware issue (bad hard drive, network issues, etc) because i can delete these files manually via windows (also working remotely, connected to the share).  I have my program dumping all information when it encounters this error, so i know which directory it was trying to delete.  Everything is fine, and i cant figure out what is causing this error.

Any ideas on this, or another way to delete files?

I have found information about it being a problem with windows, but only on windows 2000 or less (fixed after win2k SP1).  All of the PCs have the latest SP on them (all running windows 2000 SP4).  So i dont think that is the issue.

Explained in http://www-tcsn.experts-exchange.com/questions/20736947/Visual-Basic-6-0-Error-in-CopyFile-2147024832-Description-Method-'-'-of-object-'-'-failed.html

SOLUTION
Avatar of R_Rajesh
R_Rajesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kmorris1186
kmorris1186

ASKER

do you think this would delete using the full UNC path?

Like "\\machinename\share\" ?

i will check it out, she what i can get it to do..

thanks
Try This

Paste this in the Form General section
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long

Then call
DeleteFile \\FileName
would that also work with a whole directory?  I am actually deleting images out of folders.  If i delete the images one by one, it is real slow.  If i delete the directory as a whole, it is much faster.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh, didnt think it would be that simple :)

i will give it a try! i am still revamping the whole GUI of my program.  Trying to make it more user friendly.  I will get back to in a day or so once i get to the deleting code section.

Thanks! i will try all 3 ways.

Nobody has any ideas about the "Method '~' of object '~' failed" error do ya?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry this is taking em so long.  I havent had much time to finish this project up.

I have added 30 points since i am taking so long.

I havent forgotten. dont worry..