Trying to delete a non-empty folder causes error depite .DeleteAllContents & .DeletePermanently

  • Thread starter Thread starter Mugsy_in_Houston
  • Start date Start date
M

Mugsy_in_Houston

Guest
I have a simple program that zips the contents of a folder (using an external exe) and then deletes the folder. But it's giving me an error on that last step, first reporting "Directory Not Empty", but after some changes, now reports "Invalid Enum":

My.Computer.FileSystem.DeleteDirectory(foundDir, _
FileIO.DeleteDirectoryOption.DeleteAllContents, _
FileIO.RecycleOption.DeletePermanently)

From everything I've read online, this should work. This should [hard] delete the folder without prompting even though it's not empty. I could try/catch the error and skip deleting the folder, but I don't want a bunch of empty folders left lying around.

I can't figure out what I'm doing wrong. Can anyone help? TIA

1376806.jpg

Continue reading...
 
Back
Top