使用XCopy将具有精确结构的文件复制到另一个目录中 [英] Copy Files with exact Structure into another Directory using XCopy

查看:205
本文介绍了使用XCopy将具有精确结构的文件复制到另一个目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想将这个文件复制到code C:\ Majid \ File \ text.txt 到 D:\Copied code>( C:\Majid\File\text.txt ---> D:\Copied



我想使用Xcopy将它的完整目录复制到 D:\Copied ,然后我应该有这样的东西 - - > D:\Copied\Majid\File\text.txt ,您将看到驱动器号被删除,并且所有其他目录都在目标目录中创建。



如何通过XCopy执行此操作? 解决方案

这里是:

pre $ set sourceFolder =C:\Users\User\Desktop\34\ *
set destinationFolder =%sourceFolder:〜3,-1%

xcopy%sourceFolder%D:\ xcopied%destinationFolder%/ s / i / r

基于@daniel和@WahidBitar的答案。谢谢你们;)

Think I want to copy this file C:\Majid\File\text.txt to D:\Copied (C:\Majid\File\text.txt ---> D:\Copied)

I want to use Xcopy to copy that file with its full directory into D:\Copied, then I should have something like this ---> D:\Copied\Majid\File\text.txt , as you see the drive letter is removed and all of other directory is created in destination directory.

How can I do this action by XCopy?

解决方案

Here it is:

set sourceFolder="C:\Users\User\Desktop\34\*"
set destinationFolder=%sourceFolder:~3,-1%

xcopy %sourceFolder%  "D:\xcopied%destinationFolder%" /s /i /r

based on @daniel and @WahidBitar answers. Thank you men ;)

这篇关于使用XCopy将具有精确结构的文件复制到另一个目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆