Link to home
Start Free TrialLog in
Avatar of DblTMO
DblTMOFlag for United States of America

asked on

delete file permission denied using vb6

I am trying to Delete a text file but keep getting a permission denied error. I can Copy it but cannot Move or Delete it.
Avatar of odd lie
odd lie
Flag of Norway image

This can happen when someone has the file in use, try to chech if the file is in use,
If in use , try to find the owner of the file and close that connection.

regards
Oldelphi
Avatar of DblTMO

ASKER

I am the owner. I am Importing the file into Access then St the FSO = Nothing. After that I need to Copy the file to a Backup directory. After the Copy I need to Delete the orginal.
Avatar of sha_josh
sha_josh

You can delete using command prompt if you have any issues with deleting using Explorer.
1. Open command prompt
2. type this below command. I have used c:\windows\test.tmp as example file you want to delete:
del /f /q c:\windows\test.tmp

This should work!
Cheers
Try this:

    Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.DeleteFile "FileToBeDeleted", True


ASKER CERTIFIED SOLUTION
Avatar of DblTMO
DblTMO
Flag of United States of America image

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