Home > Blockchain >  XCOPY- How to copy Source Folder and all subfolder/files but INCLUDE THE SOURCE FOLDER
XCOPY- How to copy Source Folder and all subfolder/files but INCLUDE THE SOURCE FOLDER

Time:04-29

All Xcopy/robocopy documentation seems to gloss over copying the folder as if you are performing a right-click copy and paste.

I want C:\Folder to copy to D:\Whatever but I want it to look like D:\Whatever\Folder

I dont understand why all commands only focus on whats beneath the specified folder. I also cannot simply set my source as C:\ since there are other folders that I do not want to copy. What command would best execute what im looking for?

Thanks

CodePudding user response:

xcopy /s /e "C:\Folder" "D:\Whatever\Folder\"

Should create d:\whatever\Folder if it doesn't already exist, then copy c:\folder files there, and carry on to the subdirectories and create those subdirectories with their files below d:\whatever\Folder

CodePudding user response:

By specifying the expected folder name in the destination it works as I wanted. my command was xcopy C:\Folder D:\Whatever\Folder /S /I /W .

  • Related