copying all contents of folder to another folder using batch file?

后端 未结 12 1817
时光取名叫无心
时光取名叫无心 2020-12-12 19:49

I have a folder in C:\\Folder1

I want to copy all the contents of Folder1 to another location, D:\\Folder2

How do I do

12条回答
  •  自闭症患者
    2020-12-12 20:23

    Here's a solution with robocopy which copies the content of Folder1 into Folder2 going trough all subdirectories and automatically overwriting the files with the same name:

    robocopy C:\Folder1 C:\Folder2 /COPYALL /E /IS /IT
    

    Here:

    /COPYALL copies all file information
    /E copies subdirectories including empty directories
    /IS includes the same files
    /IT includes modified files with the same name

    For more parameters see the official documentation: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

    Note: it can be necessary to run the command as administrator, because of the argument /COPYALL. If you can't: just get rid of it.

提交回复
热议问题