Copy files and *replace* them in another folder using CMD?


  1. Posts : 284
    Ten
       #1

    Copy files and *replace* them in another folder using CMD?


    Hello,

    I know there a multiple tutorials online about copying files from one place to another using command line.

    My question is,

    I want to copy one folder to another folder, only thing is I want the files inside it to be replaced directly, without any prompts asking for replacement.

    Is that doable?
      My Computer


  2. Posts : 30,189
    Windows 11 Pro x64 Version 23H2
       #2

    Yes.

    Here are the switches for copy.

    /Y

    seems to be what you are looking for.

    Copy Command (Examples, Options, Switches, and More)



    Ken
      My Computer


  3. Posts : 4,187
    Windows 11 Pro, 22H2
       #3

    I like the mirror function in robocopy because it will perform an exact duplication of the source to the destination. In other words, it will even delete files in the destination that don't exist in the source making the destination a perfect replica of the source.

    Eample usage:

    Code:
    robocopy <source> <destination> /mir

    Putting some sample folders in place, it might look like this:

    Code:
    robocopy d:\source e:\destination /mir
    Tip: If you want to see what the command will do without actually performing the operation, just add a /L and it will perform a simulated execution of the command.

    The other nice thing is that it won't bother recopying files that are already present and unchanged on the destination. As a result, if you have a lot of files, or some large files, and only a few changes have taken place, the copy will be very quick since it simply skips those items that are unchanged.
      My Computers


  4. Posts : 2
    Windows10
       #4

    Hi,

    Try to use Long Path Tool, you will find your solution to copy folders with files. All the best.
      My Computer


  5. Posts : 284
    Ten
    Thread Starter
       #5

    hsehestedt said:
    I like the mirror function in robocopy because it will perform an exact duplication of the source to the destination. In other words, it will even delete files in the destination that don't exist in the source making the destination a perfect replica of the source.

    Eample usage:

    Code:
    robocopy <source> <destination> /mir

    Putting some sample folders in place, it might look like this:

    Code:
    robocopy d:\source e:\destination /mir
    Tip: If you want to see what the command will do without actually performing the operation, just add a /L and it will perform a simulated execution of the command.

    The other nice thing is that it won't bother recopying files that are already present and unchanged on the destination. As a result, if you have a lot of files, or some large files, and only a few changes have taken place, the copy will be very quick since it simply skips those items that are unchanged.
    Wow! Perfect! Exactly what I needed mate! Thank you!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:39.
Find Us




Windows 10 Forums