How to copy files from folder tree dropping all the folders with Robocopy?

Why use robocopy? It’s a good tool for a specific task but this is not the one.

You can simply use what cmd already gives you:

for /r %f in (*) do @copy "%f" target

This will essentially “flatten” your directory hierarchy. for /r will walk a directory tree recursively, looking for file names matching the given pattern. You can also specify the directory to start in:

for /r FolderA %f in (*) do @copy "%f" target

Within the loop it’s just a simply copy of the file into a specified folder.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)