Home » Questions » Computers [ Ask a new question ]

What's a command-line way to move a directory's content to another directory in Vista?

What's a command-line way to move a directory's content to another directory in Vista?

I usually love Vista but I've found its file moving facilities are just bad.

Asked by: Guest | Views: 58
Total answers/comments: 1
Guest [Entry]

"xcopy c:\dir1 c:\dir2 /E /H /R /X /Y /I /K

does the trick.

Works from Vista and 7 from the command line.

For info, this is what the switches do in this command:

/E Copies directories and subdirectories, including empty ones.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/K Copies attributes. Normal Xcopy will reset read-only attributes.

You can find out more info by typing xcopy /? at the command line.

If you then want to complete the ""move"", you simply delete c:\dir1 with rd c:\dir1 /S /Q

Might be worth sticking these two commands in a batch file (a text file with either .cmd or .bat on the end) using Notepad. Then you simply have to double-click the shortcut."