How to copy one directory to another with window command prompt?

12,060

Solution 1

Only sample.txt was copied to folder1

You need to properly specify the target directory name.

Use one of the following commands:

robocopy folder2 folder1\folder2 /COPYALL /E

Or:

xcopy folder2 folder1\folder1 /s

Further Reading

Solution 2

xcopy copies only content of folder2 to folder1. You should try this, as now you are under myfolder:

cd folder1 xcopy ..\folder2 folder2 /S /I

Solution 3

Either of the above would work. My preference is to user wildcards, where appropriate.

xcopy /s folder2\* folder1\

Share:
12,060

Related videos on Youtube

Cataclysm
Author by

Cataclysm

System.out.println("Hello " + currentViewedUser); while(stillAlive){ if(hasNewTechnology) { learnNewTechnology(myBrain , getLatestTechnology()); } } System.out.print("GoodBye World !"); You can contact me with [email protected]

Updated on September 18, 2022

Comments