windows windows下将子目录和文件剪切复制到指定目录的命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2156248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:50:20  来源:igfitidea点击:

command to cut and copy the sub directories and files to specified directory in windows

windowscommand

提问by Bharath

My question is

我的问题是

I have 3 directories and 5 files in C:\test

我在 C:\test 中有 3 个目录和 5 个文件

I want cut and paste all the files and directories under C:\test to C:\demo through command line in windows. Plz help me in this

我想通过 Windows 中的命令行将 C:\test 下的所有文件和目录剪切并粘贴到 C:\demo。请帮助我

Thx in advance

提前谢谢

回答by Pekka

If you know the directory names:

如果您知道目录名称:

move c:\test\directory1 c:\demo
move c:\test\directory2 c:\demo
move c:\test\directory3 c:\demo
move c:\test\directory4 c:\demo
move c:\test\directory5 c:\demo

回答by MartW

Use Xcopy

使用Xcopy

xcopy c:\test c:\demo /e /h

xcopy c:\test c:\demo /e /h

回答by Ana Betts

XCopy is old-school, Robocopy's where it's at

XCopy 是老派,Robocopy 的位置

robocopy C:\test C:\demo /MIR

回答by Jalaleddin Hosseini

robocopy /s C:\test C:\demo /MOVE

robocopy with /MOVE moves all files and if you use /s , also subdirectories.

robocopy 与 /MOVE 移动所有文件,如果您使用 /s ,也会移动子目录。

but without /MOVE it just copy files from source to destination.

但没有 /MOVE 它只是将文件从源复制到目标。