Robocopy command to winnow "empty" folders but keep subfolders with files

1

Have multiple-level folder trees with folders that have files and subfolders, other folders without files but with subfolders. I'd like to copy to a destination but not copy the folders lacking files, copying only the folders with files. Thus:

[source]\no_files1\files1\no_files2\no_files3\files2\no_files4\files3

is copied to

[destination]\files1\files2\files3

Stated another way, my goal is to rid my system of folders that lack files but keep any subfolders so long as a subfolder itself has a file or a subfolder.

Has me stumped.

Pohokano

Posted 2013-01-19T08:42:57.927

Reputation: 11

Answers

0

@Pohokano I believe all you need to do is include the /S copy option which says in the /? "Copy sub directories, but not empty ones." That should get you squared away if I am understanding your issue and the option correctly. Please let me know if I am right as I have never done that before.

small3687

Posted 2013-01-19T08:42:57.927

Reputation: 55