Copy directory tree without empty directories

filesystemsrsyncsynchronizationunix

I have the following tree

# upper letters = directory
# lower letters = files
A
|-- B
|-- C
    |-- D
    |-- e <= file
|-- F
    |-- G

I need to copy this tree to another destination, recursively ignoring all the empty directories. So the destination ends up looking like:

C
|-- e

How would you do this with unix, rsync, etc?

Best Answer

Of course minutes later I discover an easy method. rsync has a --prune-empty-dirs option.