PDA

View Full Version : Cannot Delete Base Folder



kcfischer
10-15-2009, 04:51 PM
I am trying to delete a folder tree that I created under the Windows Common App Data folder. I am able to delete everything but the base folder.

Anyone know how to overcome this problem?

IdeasVacuum
10-15-2009, 07:32 PM
It probably still has hidden files within it. In Tools/Folder Options/View/Advanced Settings, check the 'show hidden files and folders' option.

kcfischer
10-15-2009, 07:46 PM
Thanks for the idea but I have this turned on. In fact, the folder tree I created is under the ProgramData folder on Windows 7 which is all hidden. I can delete all the subfolders and their contents.

One interesting thing is that I tried calling the Folder.DeleteTree function twice. The first time all the files are deleted but the folder and its subfolder are not removed. The error is "folder not empty". So then I have the app sleep for 2 seconds and call the function again and this time I get the "cannot delete base folder".

Maybe this is a Windows 7 thing... I'll have to try it on XP and Vista to see if I get the same behavior.

IdeasVacuum
10-15-2009, 08:03 PM
It could be a Windows bug, perhaps they are removed but remain displayed. I saw that once in early-version XP and it actually required a re-start for the folder display to be corrected.

You could try sending a screen refresh, which is a Windows call, something like (C++):

RedrawWindow(NULL,NULL,NULL,RDW_ERASE+RDW_INVALIDA TE+RDW_ALLCHILDREN+RDW_UPDATENOW)

I think there is a WinAPI DLL for AMS mentioned elsewhere on the forum.