Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Permission denied error from dirmove function of File::Copy::Recursive.

by ikegami (Patriarch)
on Jul 22, 2011 at 20:09 UTC ( [id://916208]=note: print w/replies, xml ) Need Help??


in reply to Permission denied error from dirmove function of File::Copy::Recursive.

There's nothing you can do to force the files to get deleted.

Windows does have an means of requesting that a file gets deleted as soon as possible. This is done by calling CreateFile (which is kinda like Perl's open) using FILE_FLAG_DELETE_ON_CLOSE. I can help you implement this if you're interested in using it.

Replies are listed 'Best First'.
Re^2: Permission denied error from dirmove function of File::Copy::Recursive.
by Gulliver (Monk) on Jul 25, 2011 at 17:46 UTC

    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.

      It doesn't look like CreateFile will let me mark a directory for deletion.

      I didn't see anything either, but that means you'll be left with empty directories at worse. Is that really so bad? They can get removed the next time around.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://916208]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2025-11-12 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (68 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.