Batch file to copy files from one folder to another folder












200















I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex:



from Oldeserverstoragedata & files to New serverstoragedata & files.










share|improve this question




















  • 2





    I assume you're talking about a Windows environment?

    – Alan Plum
    Jun 12 '09 at 12:48






  • 1





    @pluma Batch files are .bat. Yes, they only run on Windows.

    – Hugo M. Zuleta
    Mar 25 '15 at 16:13






  • 2





    @HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

    – Alan Plum
    Mar 28 '15 at 16:05











  • @pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

    – Hugo M. Zuleta
    Mar 28 '15 at 16:36
















200















I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex:



from Oldeserverstoragedata & files to New serverstoragedata & files.










share|improve this question




















  • 2





    I assume you're talking about a Windows environment?

    – Alan Plum
    Jun 12 '09 at 12:48






  • 1





    @pluma Batch files are .bat. Yes, they only run on Windows.

    – Hugo M. Zuleta
    Mar 25 '15 at 16:13






  • 2





    @HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

    – Alan Plum
    Mar 28 '15 at 16:05











  • @pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

    – Hugo M. Zuleta
    Mar 28 '15 at 16:36














200












200








200


49






I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex:



from Oldeserverstoragedata & files to New serverstoragedata & files.










share|improve this question
















I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex:



from Oldeserverstoragedata & files to New serverstoragedata & files.







batch-file file-io






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 28 '14 at 19:38









Adam

70821436




70821436










asked Jun 12 '09 at 12:45









user73628user73628

1,43052123




1,43052123








  • 2





    I assume you're talking about a Windows environment?

    – Alan Plum
    Jun 12 '09 at 12:48






  • 1





    @pluma Batch files are .bat. Yes, they only run on Windows.

    – Hugo M. Zuleta
    Mar 25 '15 at 16:13






  • 2





    @HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

    – Alan Plum
    Mar 28 '15 at 16:05











  • @pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

    – Hugo M. Zuleta
    Mar 28 '15 at 16:36














  • 2





    I assume you're talking about a Windows environment?

    – Alan Plum
    Jun 12 '09 at 12:48






  • 1





    @pluma Batch files are .bat. Yes, they only run on Windows.

    – Hugo M. Zuleta
    Mar 25 '15 at 16:13






  • 2





    @HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

    – Alan Plum
    Mar 28 '15 at 16:05











  • @pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

    – Hugo M. Zuleta
    Mar 28 '15 at 16:36








2




2





I assume you're talking about a Windows environment?

– Alan Plum
Jun 12 '09 at 12:48





I assume you're talking about a Windows environment?

– Alan Plum
Jun 12 '09 at 12:48




1




1





@pluma Batch files are .bat. Yes, they only run on Windows.

– Hugo M. Zuleta
Mar 25 '15 at 16:13





@pluma Batch files are .bat. Yes, they only run on Windows.

– Hugo M. Zuleta
Mar 25 '15 at 16:13




2




2





@HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

– Alan Plum
Mar 28 '15 at 16:05





@HugoM.Zuleta, I'm aware of .bat files. But "batch file" is not necessarily guaranteeing a Windows environment. The use of the term pre-dates Windows (as do .bat files) and I've even seen novices use the term to mean "shell scripts" in *nix environments.

– Alan Plum
Mar 28 '15 at 16:05













@pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

– Hugo M. Zuleta
Mar 28 '15 at 16:36





@pluma I agree, and this is mostly because they refer to batch operations done by their OS's scripting tools.

– Hugo M. Zuleta
Mar 28 '15 at 16:36












8 Answers
8






active

oldest

votes


















377














xcopy.exe is definitely your friend here.
It's built into Windows, so its cost is nothing.



Just xcopy /s c:source d:target



You'd probably want to tweak a few things; some of the options we also add include these:





  • /s/e - recursive copy, including copying empty directories.


  • /v - add this to verify the copy against the original. slower, but for the paranoid.


  • /h - copy system and hidden files.


  • /k - copy read-only attributes along with files. otherwise, all files become read-write.


  • /x - if you care about permissions, you might want /o or /x.


  • /y - don't prompt before overwriting existing files.


  • /z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.


If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:source d:target.



Hope this helps.






share|improve this answer





















  • 18





    it is advised to quote your source and target pad...

    – VDP
    Jul 26 '12 at 12:03






  • 2





    @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

    – Bitterblue
    Jan 9 '13 at 10:33






  • 2





    /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

    – lavinio
    Mar 5 '13 at 4:04






  • 1





    How to copy a single file from the directory?

    – Charan Raju C R
    Jan 7 '14 at 5:56






  • 7





    To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

    – wintondeshong
    Apr 9 '14 at 11:30



















47














Just to be clear, when you use xcopy /s c:source d:target, put "" around the c:source and d:target,otherwise you get error.



ie if there are spaces in the path ie if you have:



"C:Some Folder*.txt"


but not required if you have:



C:SomeFolder*.txt





share|improve this answer


























  • The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

    – Joel Carneiro
    Dec 16 '18 at 13:48





















41














My favorite one to backup data is:



ROBOCOPY "C:folder" "C:new_folder" /mir


/mir is for mirror. You can also use /mov to move files. It reproduce the exact same folder. It can delete/overwrite files as needed. Works great for me. It's faster than xcopy / copy. It's built in Windows as well.



Source: http://technet.microsoft.com/en-us/library/cc733145.aspx






share|improve this answer





















  • 2





    I support this. It is really fast. much faster than xcopy

    – Ike
    Jul 4 '15 at 2:30













  • Is there a way to recursively remove thumbs.db similar to this?

    – drooh
    Jan 2 '17 at 22:14



















17














You may want to take a look at XCopy or RoboCopy which are pretty comprehensive solutions for nearly all file copy operations on Windows.






share|improve this answer



















  • 3





    RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

    – Bitterblue
    Jan 9 '13 at 10:51











  • @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

    – Tom C
    Apr 3 '13 at 11:12






  • 2





    @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

    – ndm13
    Jun 9 '14 at 2:39



















13














To bypass the 'specify a file name or directory name on the target (F = file, D = directory)?' prompt with xcopy, you can do the following...



echo f | xcopy /f /y srcfile destfile



or for those of us just copying large substructures/folders:



use /i which specifies destination must be a directory if copying more than one file






share|improve this answer


























  • (echo "f" for files or "D" for directories)

    – JinSnow
    Nov 26 '15 at 9:46











  • trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

    – Prof
    Apr 8 '16 at 6:42











  • My man ! Thanks

    – Wifsimster
    Jun 21 '18 at 13:38



















2














if you want to copy file not using absolute path, relative path in other words:



don't forget to write antislash in the path AND NOT slash (^^)



example :



    copy children-folderfile.something .other-children-folder


PS: absolute path can be retrieved use these wildcards called "batch parameters"



    @echo off
echo %%~dp0 is "%~dp0"
echo %%0 is "%0"
echo %%~dpnx0 is "%~dpnx0"
echo %%~f1 is "%~f1"
echo %%~dp0%%~1 is "%~dp0%~1"


check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx



and also here for batch parameters documentation:
https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true






share|improve this answer































    0














    Look at rsync based Windows tool NASBackup. It will be a bonus if you are acquainted with rsync commands.






    share|improve this answer

































      0














      @echo off

      rem The * at the end of the destination file is to avoid File/Directory Internal Question.

      rem You can do this for each especific file. (Make sure you already have permissions to the path)
      xcopy /Y "\OldeserverstoragedataMyFile01.txt" "\New serverstoragedataMyFile01.txt"*
      pause

      rem You can use "copy" instead of "xcopy "for this example.





      share|improve this answer
























        protected by Community Oct 6 '12 at 0:49



        Thank you for your interest in this question.
        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



        Would you like to answer one of these unanswered questions instead?














        8 Answers
        8






        active

        oldest

        votes








        8 Answers
        8






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        377














        xcopy.exe is definitely your friend here.
        It's built into Windows, so its cost is nothing.



        Just xcopy /s c:source d:target



        You'd probably want to tweak a few things; some of the options we also add include these:





        • /s/e - recursive copy, including copying empty directories.


        • /v - add this to verify the copy against the original. slower, but for the paranoid.


        • /h - copy system and hidden files.


        • /k - copy read-only attributes along with files. otherwise, all files become read-write.


        • /x - if you care about permissions, you might want /o or /x.


        • /y - don't prompt before overwriting existing files.


        • /z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.


        If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:source d:target.



        Hope this helps.






        share|improve this answer





















        • 18





          it is advised to quote your source and target pad...

          – VDP
          Jul 26 '12 at 12:03






        • 2





          @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

          – Bitterblue
          Jan 9 '13 at 10:33






        • 2





          /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

          – lavinio
          Mar 5 '13 at 4:04






        • 1





          How to copy a single file from the directory?

          – Charan Raju C R
          Jan 7 '14 at 5:56






        • 7





          To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

          – wintondeshong
          Apr 9 '14 at 11:30
















        377














        xcopy.exe is definitely your friend here.
        It's built into Windows, so its cost is nothing.



        Just xcopy /s c:source d:target



        You'd probably want to tweak a few things; some of the options we also add include these:





        • /s/e - recursive copy, including copying empty directories.


        • /v - add this to verify the copy against the original. slower, but for the paranoid.


        • /h - copy system and hidden files.


        • /k - copy read-only attributes along with files. otherwise, all files become read-write.


        • /x - if you care about permissions, you might want /o or /x.


        • /y - don't prompt before overwriting existing files.


        • /z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.


        If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:source d:target.



        Hope this helps.






        share|improve this answer





















        • 18





          it is advised to quote your source and target pad...

          – VDP
          Jul 26 '12 at 12:03






        • 2





          @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

          – Bitterblue
          Jan 9 '13 at 10:33






        • 2





          /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

          – lavinio
          Mar 5 '13 at 4:04






        • 1





          How to copy a single file from the directory?

          – Charan Raju C R
          Jan 7 '14 at 5:56






        • 7





          To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

          – wintondeshong
          Apr 9 '14 at 11:30














        377












        377








        377







        xcopy.exe is definitely your friend here.
        It's built into Windows, so its cost is nothing.



        Just xcopy /s c:source d:target



        You'd probably want to tweak a few things; some of the options we also add include these:





        • /s/e - recursive copy, including copying empty directories.


        • /v - add this to verify the copy against the original. slower, but for the paranoid.


        • /h - copy system and hidden files.


        • /k - copy read-only attributes along with files. otherwise, all files become read-write.


        • /x - if you care about permissions, you might want /o or /x.


        • /y - don't prompt before overwriting existing files.


        • /z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.


        If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:source d:target.



        Hope this helps.






        share|improve this answer















        xcopy.exe is definitely your friend here.
        It's built into Windows, so its cost is nothing.



        Just xcopy /s c:source d:target



        You'd probably want to tweak a few things; some of the options we also add include these:





        • /s/e - recursive copy, including copying empty directories.


        • /v - add this to verify the copy against the original. slower, but for the paranoid.


        • /h - copy system and hidden files.


        • /k - copy read-only attributes along with files. otherwise, all files become read-write.


        • /x - if you care about permissions, you might want /o or /x.


        • /y - don't prompt before overwriting existing files.


        • /z - if you think the copy might fail and you want to restart it, use this. It places a marker on each file as it copies, so you can rerun the xcopy command to pick up from where it left off.


        If you think the xcopy might fail partway through (like when you are copying over a flaky network connection), or that you have to stop it and want to continue it later, you can use xcopy /s/z c:source d:target.



        Hope this helps.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 3 '14 at 20:04

























        answered Jun 12 '09 at 12:57









        laviniolavinio

        20.4k44766




        20.4k44766








        • 18





          it is advised to quote your source and target pad...

          – VDP
          Jul 26 '12 at 12:03






        • 2





          @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

          – Bitterblue
          Jan 9 '13 at 10:33






        • 2





          /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

          – lavinio
          Mar 5 '13 at 4:04






        • 1





          How to copy a single file from the directory?

          – Charan Raju C R
          Jan 7 '14 at 5:56






        • 7





          To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

          – wintondeshong
          Apr 9 '14 at 11:30














        • 18





          it is advised to quote your source and target pad...

          – VDP
          Jul 26 '12 at 12:03






        • 2





          @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

          – Bitterblue
          Jan 9 '13 at 10:33






        • 2





          /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

          – lavinio
          Mar 5 '13 at 4:04






        • 1





          How to copy a single file from the directory?

          – Charan Raju C R
          Jan 7 '14 at 5:56






        • 7





          To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

          – wintondeshong
          Apr 9 '14 at 11:30








        18




        18





        it is advised to quote your source and target pad...

        – VDP
        Jul 26 '12 at 12:03





        it is advised to quote your source and target pad...

        – VDP
        Jul 26 '12 at 12:03




        2




        2





        @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

        – Bitterblue
        Jan 9 '13 at 10:33





        @Iavinio It's asking file or directory when copying an archive. Is there a way to suppress that ?

        – Bitterblue
        Jan 9 '13 at 10:33




        2




        2





        /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

        – lavinio
        Mar 5 '13 at 4:04





        /i - If destination does not exist and copying more than one file, assumes that destination must be a directory.

        – lavinio
        Mar 5 '13 at 4:04




        1




        1





        How to copy a single file from the directory?

        – Charan Raju C R
        Jan 7 '14 at 5:56





        How to copy a single file from the directory?

        – Charan Raju C R
        Jan 7 '14 at 5:56




        7




        7





        To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

        – wintondeshong
        Apr 9 '14 at 11:30





        To get around the "file or directory" prompt, do the command like so... echo f | xcopy /s /f srcfile destfile

        – wintondeshong
        Apr 9 '14 at 11:30













        47














        Just to be clear, when you use xcopy /s c:source d:target, put "" around the c:source and d:target,otherwise you get error.



        ie if there are spaces in the path ie if you have:



        "C:Some Folder*.txt"


        but not required if you have:



        C:SomeFolder*.txt





        share|improve this answer


























        • The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

          – Joel Carneiro
          Dec 16 '18 at 13:48


















        47














        Just to be clear, when you use xcopy /s c:source d:target, put "" around the c:source and d:target,otherwise you get error.



        ie if there are spaces in the path ie if you have:



        "C:Some Folder*.txt"


        but not required if you have:



        C:SomeFolder*.txt





        share|improve this answer


























        • The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

          – Joel Carneiro
          Dec 16 '18 at 13:48
















        47












        47








        47







        Just to be clear, when you use xcopy /s c:source d:target, put "" around the c:source and d:target,otherwise you get error.



        ie if there are spaces in the path ie if you have:



        "C:Some Folder*.txt"


        but not required if you have:



        C:SomeFolder*.txt





        share|improve this answer















        Just to be clear, when you use xcopy /s c:source d:target, put "" around the c:source and d:target,otherwise you get error.



        ie if there are spaces in the path ie if you have:



        "C:Some Folder*.txt"


        but not required if you have:



        C:SomeFolder*.txt






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jul 26 '13 at 19:31









        Morgan

        15.8k44271




        15.8k44271










        answered Mar 27 '13 at 14:30









        IkeIke

        782817




        782817













        • The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

          – Joel Carneiro
          Dec 16 '18 at 13:48





















        • The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

          – Joel Carneiro
          Dec 16 '18 at 13:48



















        The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

        – Joel Carneiro
        Dec 16 '18 at 13:48







        The quotation marks made the trick ;) thanks I also used /Y to replace the file if it exists :) Example: ´´´xcopy /s "c:source" "d:target" /Y```

        – Joel Carneiro
        Dec 16 '18 at 13:48













        41














        My favorite one to backup data is:



        ROBOCOPY "C:folder" "C:new_folder" /mir


        /mir is for mirror. You can also use /mov to move files. It reproduce the exact same folder. It can delete/overwrite files as needed. Works great for me. It's faster than xcopy / copy. It's built in Windows as well.



        Source: http://technet.microsoft.com/en-us/library/cc733145.aspx






        share|improve this answer





















        • 2





          I support this. It is really fast. much faster than xcopy

          – Ike
          Jul 4 '15 at 2:30













        • Is there a way to recursively remove thumbs.db similar to this?

          – drooh
          Jan 2 '17 at 22:14
















        41














        My favorite one to backup data is:



        ROBOCOPY "C:folder" "C:new_folder" /mir


        /mir is for mirror. You can also use /mov to move files. It reproduce the exact same folder. It can delete/overwrite files as needed. Works great for me. It's faster than xcopy / copy. It's built in Windows as well.



        Source: http://technet.microsoft.com/en-us/library/cc733145.aspx






        share|improve this answer





















        • 2





          I support this. It is really fast. much faster than xcopy

          – Ike
          Jul 4 '15 at 2:30













        • Is there a way to recursively remove thumbs.db similar to this?

          – drooh
          Jan 2 '17 at 22:14














        41












        41








        41







        My favorite one to backup data is:



        ROBOCOPY "C:folder" "C:new_folder" /mir


        /mir is for mirror. You can also use /mov to move files. It reproduce the exact same folder. It can delete/overwrite files as needed. Works great for me. It's faster than xcopy / copy. It's built in Windows as well.



        Source: http://technet.microsoft.com/en-us/library/cc733145.aspx






        share|improve this answer















        My favorite one to backup data is:



        ROBOCOPY "C:folder" "C:new_folder" /mir


        /mir is for mirror. You can also use /mov to move files. It reproduce the exact same folder. It can delete/overwrite files as needed. Works great for me. It's faster than xcopy / copy. It's built in Windows as well.



        Source: http://technet.microsoft.com/en-us/library/cc733145.aspx







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jul 19 '18 at 14:59

























        answered Aug 19 '13 at 19:27









        Etienne DupuisEtienne Dupuis

        10.1k54053




        10.1k54053








        • 2





          I support this. It is really fast. much faster than xcopy

          – Ike
          Jul 4 '15 at 2:30













        • Is there a way to recursively remove thumbs.db similar to this?

          – drooh
          Jan 2 '17 at 22:14














        • 2





          I support this. It is really fast. much faster than xcopy

          – Ike
          Jul 4 '15 at 2:30













        • Is there a way to recursively remove thumbs.db similar to this?

          – drooh
          Jan 2 '17 at 22:14








        2




        2





        I support this. It is really fast. much faster than xcopy

        – Ike
        Jul 4 '15 at 2:30







        I support this. It is really fast. much faster than xcopy

        – Ike
        Jul 4 '15 at 2:30















        Is there a way to recursively remove thumbs.db similar to this?

        – drooh
        Jan 2 '17 at 22:14





        Is there a way to recursively remove thumbs.db similar to this?

        – drooh
        Jan 2 '17 at 22:14











        17














        You may want to take a look at XCopy or RoboCopy which are pretty comprehensive solutions for nearly all file copy operations on Windows.






        share|improve this answer



















        • 3





          RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

          – Bitterblue
          Jan 9 '13 at 10:51











        • @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

          – Tom C
          Apr 3 '13 at 11:12






        • 2





          @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

          – ndm13
          Jun 9 '14 at 2:39
















        17














        You may want to take a look at XCopy or RoboCopy which are pretty comprehensive solutions for nearly all file copy operations on Windows.






        share|improve this answer



















        • 3





          RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

          – Bitterblue
          Jan 9 '13 at 10:51











        • @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

          – Tom C
          Apr 3 '13 at 11:12






        • 2





          @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

          – ndm13
          Jun 9 '14 at 2:39














        17












        17








        17







        You may want to take a look at XCopy or RoboCopy which are pretty comprehensive solutions for nearly all file copy operations on Windows.






        share|improve this answer













        You may want to take a look at XCopy or RoboCopy which are pretty comprehensive solutions for nearly all file copy operations on Windows.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 12 '09 at 12:48









        JoeyJoey

        265k62564599




        265k62564599








        • 3





          RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

          – Bitterblue
          Jan 9 '13 at 10:51











        • @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

          – Tom C
          Apr 3 '13 at 11:12






        • 2





          @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

          – ndm13
          Jun 9 '14 at 2:39














        • 3





          RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

          – Bitterblue
          Jan 9 '13 at 10:51











        • @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

          – Tom C
          Apr 3 '13 at 11:12






        • 2





          @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

          – ndm13
          Jun 9 '14 at 2:39








        3




        3





        RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

        – Bitterblue
        Jan 9 '13 at 10:51





        RoboCopy seems to be better than XCopy because xcopy asks for file or folder decisions. And I can't turn it down. It MUST be able to work full automatic.

        – Bitterblue
        Jan 9 '13 at 10:51













        @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

        – Tom C
        Apr 3 '13 at 11:12





        @mini-me I know this is very late however I cant find the same relevant switch. I ended up resorting to making it create a blank file with the same name I am copying to and then overwrite it. If the file already exists then it doesnt bother asking if its a file or directory. (If you want auto directory then you can append a '/' to the path and it will do it). Hope this helps future people!

        – Tom C
        Apr 3 '13 at 11:12




        2




        2





        @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

        – ndm13
        Jun 9 '14 at 2:39





        @Eve For reference, echo f | xcopy source destination /y will make it automatic. It assigns all questions an "f" as a response. It will also pass overwrite requests (f is taken as yes, I think).

        – ndm13
        Jun 9 '14 at 2:39











        13














        To bypass the 'specify a file name or directory name on the target (F = file, D = directory)?' prompt with xcopy, you can do the following...



        echo f | xcopy /f /y srcfile destfile



        or for those of us just copying large substructures/folders:



        use /i which specifies destination must be a directory if copying more than one file






        share|improve this answer


























        • (echo "f" for files or "D" for directories)

          – JinSnow
          Nov 26 '15 at 9:46











        • trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

          – Prof
          Apr 8 '16 at 6:42











        • My man ! Thanks

          – Wifsimster
          Jun 21 '18 at 13:38
















        13














        To bypass the 'specify a file name or directory name on the target (F = file, D = directory)?' prompt with xcopy, you can do the following...



        echo f | xcopy /f /y srcfile destfile



        or for those of us just copying large substructures/folders:



        use /i which specifies destination must be a directory if copying more than one file






        share|improve this answer


























        • (echo "f" for files or "D" for directories)

          – JinSnow
          Nov 26 '15 at 9:46











        • trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

          – Prof
          Apr 8 '16 at 6:42











        • My man ! Thanks

          – Wifsimster
          Jun 21 '18 at 13:38














        13












        13








        13







        To bypass the 'specify a file name or directory name on the target (F = file, D = directory)?' prompt with xcopy, you can do the following...



        echo f | xcopy /f /y srcfile destfile



        or for those of us just copying large substructures/folders:



        use /i which specifies destination must be a directory if copying more than one file






        share|improve this answer















        To bypass the 'specify a file name or directory name on the target (F = file, D = directory)?' prompt with xcopy, you can do the following...



        echo f | xcopy /f /y srcfile destfile



        or for those of us just copying large substructures/folders:



        use /i which specifies destination must be a directory if copying more than one file







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 8 '15 at 20:51









        Community

        11




        11










        answered Apr 9 '14 at 11:32









        wintondeshongwintondeshong

        8811217




        8811217













        • (echo "f" for files or "D" for directories)

          – JinSnow
          Nov 26 '15 at 9:46











        • trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

          – Prof
          Apr 8 '16 at 6:42











        • My man ! Thanks

          – Wifsimster
          Jun 21 '18 at 13:38



















        • (echo "f" for files or "D" for directories)

          – JinSnow
          Nov 26 '15 at 9:46











        • trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

          – Prof
          Apr 8 '16 at 6:42











        • My man ! Thanks

          – Wifsimster
          Jun 21 '18 at 13:38

















        (echo "f" for files or "D" for directories)

        – JinSnow
        Nov 26 '15 at 9:46





        (echo "f" for files or "D" for directories)

        – JinSnow
        Nov 26 '15 at 9:46













        trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

        – Prof
        Apr 8 '16 at 6:42





        trying to do this now and it just aint working - I always get prompts when trying to copy one file to another directory. Using Win 10 if that affects it at all echo f | xcopy /f /y "My.dll" "C:myFolderMy.dll". I've tried it with a combination of other switches to no avail (and capital F)

        – Prof
        Apr 8 '16 at 6:42













        My man ! Thanks

        – Wifsimster
        Jun 21 '18 at 13:38





        My man ! Thanks

        – Wifsimster
        Jun 21 '18 at 13:38











        2














        if you want to copy file not using absolute path, relative path in other words:



        don't forget to write antislash in the path AND NOT slash (^^)



        example :



            copy children-folderfile.something .other-children-folder


        PS: absolute path can be retrieved use these wildcards called "batch parameters"



            @echo off
        echo %%~dp0 is "%~dp0"
        echo %%0 is "%0"
        echo %%~dpnx0 is "%~dpnx0"
        echo %%~f1 is "%~f1"
        echo %%~dp0%%~1 is "%~dp0%~1"


        check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx



        and also here for batch parameters documentation:
        https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true






        share|improve this answer




























          2














          if you want to copy file not using absolute path, relative path in other words:



          don't forget to write antislash in the path AND NOT slash (^^)



          example :



              copy children-folderfile.something .other-children-folder


          PS: absolute path can be retrieved use these wildcards called "batch parameters"



              @echo off
          echo %%~dp0 is "%~dp0"
          echo %%0 is "%0"
          echo %%~dpnx0 is "%~dpnx0"
          echo %%~f1 is "%~f1"
          echo %%~dp0%%~1 is "%~dp0%~1"


          check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx



          and also here for batch parameters documentation:
          https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true






          share|improve this answer


























            2












            2








            2







            if you want to copy file not using absolute path, relative path in other words:



            don't forget to write antislash in the path AND NOT slash (^^)



            example :



                copy children-folderfile.something .other-children-folder


            PS: absolute path can be retrieved use these wildcards called "batch parameters"



                @echo off
            echo %%~dp0 is "%~dp0"
            echo %%0 is "%0"
            echo %%~dpnx0 is "%~dpnx0"
            echo %%~f1 is "%~f1"
            echo %%~dp0%%~1 is "%~dp0%~1"


            check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx



            and also here for batch parameters documentation:
            https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true






            share|improve this answer













            if you want to copy file not using absolute path, relative path in other words:



            don't forget to write antislash in the path AND NOT slash (^^)



            example :



                copy children-folderfile.something .other-children-folder


            PS: absolute path can be retrieved use these wildcards called "batch parameters"



                @echo off
            echo %%~dp0 is "%~dp0"
            echo %%0 is "%0"
            echo %%~dpnx0 is "%~dpnx0"
            echo %%~f1 is "%~f1"
            echo %%~dp0%%~1 is "%~dp0%~1"


            check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx



            and also here for batch parameters documentation:
            https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 24 '18 at 20:28









            marcdahanmarcdahan

            74179




            74179























                0














                Look at rsync based Windows tool NASBackup. It will be a bonus if you are acquainted with rsync commands.






                share|improve this answer






























                  0














                  Look at rsync based Windows tool NASBackup. It will be a bonus if you are acquainted with rsync commands.






                  share|improve this answer




























                    0












                    0








                    0







                    Look at rsync based Windows tool NASBackup. It will be a bonus if you are acquainted with rsync commands.






                    share|improve this answer















                    Look at rsync based Windows tool NASBackup. It will be a bonus if you are acquainted with rsync commands.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 3 '13 at 11:20









                    Joey

                    265k62564599




                    265k62564599










                    answered Jun 12 '09 at 12:53









                    niknik

                    11.1k33048




                    11.1k33048























                        0














                        @echo off

                        rem The * at the end of the destination file is to avoid File/Directory Internal Question.

                        rem You can do this for each especific file. (Make sure you already have permissions to the path)
                        xcopy /Y "\OldeserverstoragedataMyFile01.txt" "\New serverstoragedataMyFile01.txt"*
                        pause

                        rem You can use "copy" instead of "xcopy "for this example.





                        share|improve this answer






























                          0














                          @echo off

                          rem The * at the end of the destination file is to avoid File/Directory Internal Question.

                          rem You can do this for each especific file. (Make sure you already have permissions to the path)
                          xcopy /Y "\OldeserverstoragedataMyFile01.txt" "\New serverstoragedataMyFile01.txt"*
                          pause

                          rem You can use "copy" instead of "xcopy "for this example.





                          share|improve this answer




























                            0












                            0








                            0







                            @echo off

                            rem The * at the end of the destination file is to avoid File/Directory Internal Question.

                            rem You can do this for each especific file. (Make sure you already have permissions to the path)
                            xcopy /Y "\OldeserverstoragedataMyFile01.txt" "\New serverstoragedataMyFile01.txt"*
                            pause

                            rem You can use "copy" instead of "xcopy "for this example.





                            share|improve this answer















                            @echo off

                            rem The * at the end of the destination file is to avoid File/Directory Internal Question.

                            rem You can do this for each especific file. (Make sure you already have permissions to the path)
                            xcopy /Y "\OldeserverstoragedataMyFile01.txt" "\New serverstoragedataMyFile01.txt"*
                            pause

                            rem You can use "copy" instead of "xcopy "for this example.






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 21 '18 at 22:55

























                            answered Nov 21 '18 at 22:32









                            David CastroDavid Castro

                            58956




                            58956

















                                protected by Community Oct 6 '12 at 0:49



                                Thank you for your interest in this question.
                                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                Would you like to answer one of these unanswered questions instead?



                                Popular posts from this blog

                                "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                Alcedinidae

                                RAC Tourist Trophy