So instead of moving the directories I could copy them and then delete each file one at a time. Any file that can't be deleted I could use CreateFile to mark it to be deleted when closed.
Your link led me to GetSecurityInfo which can be used to get security information about a directory. If a delete directory failed I could get information about who has it open. It doesn't look like CreateFile will let me mark a directory for deletion. But I think I'm getting in a little over my head now.
From Creating and Deleting Directories:
To delete an existing directory, use the RemoveDirectory or RemoveDirectoryTransacted function. Before removing a directory, you must ensure that the directory is empty and that you have the delete access privilege for the directory. To do the latter, call the GetSecurityInfo function.
In reply to Re^2: Permission denied error from dirmove function of File::Copy::Recursive.
by Gulliver
in thread Permission denied error from dirmove function of File::Copy::Recursive.
by Gulliver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |