Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just want an equivalent of "mv dir target", and have dir get moved to target\dir.

  • cmd move doesn't even work across filesystems
  • powershell's doesn't either
  • xcopy doesn't move
  • robocopy fails at "robocopy.exe /move p1 p2 dir-in-p1" (the syntax here is the problem, see the accepted answer)
share|improve this question
up vote 7 down vote accepted

Robocopy does it fine.

taking the folder logs and moving it into the documents folder (same level):

robocopy logs documents\logs /move

This worked fine, it moved it without needing a folder created ahead of time and its no longer in the original location.

share|improve this answer
Ug, still need to differentiate between a directory and a file as the above syntax doesn't work if "logs" is a file. – Ian Kelling Oct 23 '09 at 5:40
Then use: move logs documents\logs That will accomplish the task for a file – Shial Oct 23 '09 at 6:02

Not sure what's wrong with running the built-in move command - it moves across file systems just fine on my desktop (Windows XP).

F:\>help move
Moves files and renames files and directories.

To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

  [drive:][path]filename1 Specifies the location and name of the file
                          or files you want to move.
  destination             Specifies the new location of the file. Destination
                          can consist of a drive letter and colon, a
                          directory name, or a combination. If you are moving
                          only one file, you can also include a filename if
                          you want to rename the file when you move it.
  [drive:][path]dirname1  Specifies the directory you want to rename.
  dirname2                Specifies the new name of the directory.

  /Y                      Suppresses prompting to confirm you want to
                          overwrite an existing destination file.
  /-Y                     Causes prompting to confirm you want to overwrite
                          an existing destination file.

The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.  Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
share|improve this answer
Try moving a directory across filesystems. I get "access denied". – Ian Kelling Oct 23 '09 at 5:44
maybe it's a permissions issue? Which is now especially weird because it worked for me yesterday (as admin on my workstation), but not for my AD account (non admin). There's also the option of move dir\* [drive:]\path\target which works for me also – warren Oct 23 '09 at 5:58

My approach is to install Cygwin and use 'mv'. But, then, whenever I'm forced to work on Windows installing Cygwin is one of my first actions.

share|improve this answer
Ok.. I just don't know how to launch cygwin for a single command from cmd. How? – Ian Kelling Oct 22 '09 at 2:14
An alternative to Cygwin is Subsystem for Unix Applications by Microsoft. It integrates into the Windows cmd shell, so you just type commands as usual. – Joe Internet Oct 22 '09 at 5:01
Given a full-featured shell, why would you want to use cmd? – divegeek Oct 22 '09 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.