Copy directory tree without empty directories?

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


There are various solutions to this problem (Taken from this web page):

This option uses the mkdir command with the find command. This method also requires that you be inside the source folder while executing the command.

bash$ cd /path/to/source && find . -type d -exec mkdir -p /path/to/dest/{} ;

Using find and cpio

bash$ find /path/to/source -type d | cpio -pd /path/to/dest/

Using Rsync

bash$ rsync -a --include '*/' --exclude '*' /path/to/source /path/to/dest

OR

bash$ rysnc -a -f"+ */" -f"- *" /path/to/source /path/to/dest