in reply to Moving directories on Win32

Without seeing the code and the exact error, I can only guess...but the first guess is that your program is running from, has chdir'd to, or opened the directory you are trying to move.

Replies are listed 'Best First'.
Re^2: Moving directories on Win32
by aplonis (Pilgrim) on Nov 28, 2007 at 18:46 UTC

    Here is the directory structure...

    C:/foo/bar/DESKTOP/SCRIPT_CWD/INNER/INNERMOST

    ...and the script residing in SCRIPT_CWD is trying to move INNERMOST out of INNER and into DESKTOP.

      Yes, but do you have a resource open in INNERMOST when you are attempting to do the move? If not, does DESKTOP have a resource that must be replaced but is in use?

        The most common case (for me, at least) is an application has the directory as its current directory.

        The second most common case (for me, at least) is Explorer* keeping a handle to the directory open for no apparent reason. Nothing short of restarting Explorer (which means rebooting) or messing with its internals using Process Explorer will close the handle as far as I know.

        * — Explorer is the program that provides Folder windows, Windows Explorer windows, My Computer windows, the Destkop, the Taskbar and more) holding