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 ;)