Can’t move directories across disk boundaries with “move” at command line

command-line-interfacefile-permissionswindows-server-2008

I need to move a huge list of directories from disk C (internal) to disk E (usb) on a Windows Server 2008 box. I'd planned to just make a big .bat file with thousands of "move" commands. Low-tech, but seems simple enough.

But if I type "move c:\myDir e:\", I get "access denied" — even if I'm logged in as Administrator, running an elevated-permissions cmd.exe.

I granted Administrator Full Control on both C and E; still access denied.

If I drag the directories using the GUI, it works fine.

What am I missing?

Best Answer

The help for the "move" command says that it "Moves files and renames files and directories." It does not say that the "move" command moves directories.

From the CLI, you can use copy c:\mydir e:\ /s and then rmdir c:\mydir /s.

I would suggest using robocopy c:\mydir e:\ /move /s. robocopy is available on any modern installation of windows and provides useful feedback when copying large amounts of data.

If you are using Powershell and not cmd.exe, you could easily write a little helper function or alias to help shorten/simplify the commands.