Search code examples
batch-filecmdwindows-10copy-pasterobocopy

Copy one folder into another directory in commend prompt


I want to copy one folder into another directory with all content on Windows 10. I used :

xcopy "C:\Users\X\Desktop\projects\XX\XXX\folder1" "C:\Users\X\Desktop\projects\XX\XXX\folder2"  /E /C /I /Y

this :

xcopy "C:\Users\X\Desktop\projects\XX\XXX\folder1" "C:\Users\X\Desktop\projects\XX\XXX\folder2\"  /E /C /I /Y

and :

robocopy"C:\Users\X\Desktop\projects\XX\XXX\folder1" "C:\Users\X\Desktop\projects\XX\XXX\folder2" /COPYALL /E`

but it only copy files which are in this directory and move it to another.

My goal is like we could right-click on mouse on folder and "copy" then "paste" it into another dir.

What is an issue into my commend?


Solution

  • Ok, so what you want is folder1 to be created in folder2 (was not clear to me reading the question)

    So try:

    xcopy "...\XX\XXX\folder1" "..\XX\XXX\folder2\folder1" /cheirky
    

    No need to create folder2\folder1, /I flag makes it for you