问题描述
假设我想将这个文件复制到code C:\ Majid \ File \ text.txt 到 code>( C:\Majid\File\text.txt ---> D:\Copied )我想使用Xcopy将它的完整目录复制到 D:\Copied ,然后我应该有这样的东西 - - > D:\Copied\Majid\File\text.txt ,您将看到驱动器号被删除,并且所有其他目录都在目标目录中创建。
如何通过XCopy执行此操作? 解决方案
我想使用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将具有精确结构的文件复制到另一个目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!