当前位置: 动力学知识库 > 问答 > 编程问答 >

Elegant way to copy all files from a folder tree onto one folder preferably using robocopy?

问题描述:

I have the following job which I would like to run: I have a folder with numerous subfolders containing about 50,000 files which I would like to copy onto a single folder. I thought the most straight forward way would be using the search function in windows explorer, searching all files of the folder by using . and then droping the files into the target folder. However, this only causes trouble and finally the number of files in the new folder is not the same than in the original folder. After some research on command line tools I found robocopy which seemingly is quite good but I did not manage to get what I want. I manage to mirror the folder or to move all files but the folder structure will be retained using the standard commands as for example

robocopy C:\originalFolder C:\targetfolder /e /move

does anybody have an idea how to approach this question further? I am not bound to robocopy but what I really like is the possibility to write a log file.

Thanks a lot. Herbie

网友答案:

I now tried

for /r C:\originalFolder %f in (*) do @xcopy "%f" C:\targetFolder /Y /H

a modification of a script I found which does basically what I wish, but still the number of files in the target folder is >1000 less than in the original folder. Does anybody have an idea?

分享给朋友:
您可能感兴趣的文章:
随机阅读: