'XCOPY- How to copy Source Folder and all subfolder/files but INCLUDE THE SOURCE FOLDER
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
Solution 1:[1]
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
Solution 2:[2]
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 .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Clint Siebert |
