Duplicating folder structure (without the files) on Mac OS X / Terminal

Ah I love this. From Superuser.

Another solution which works for me is to use rsync and exclude all files, e.g.

$ rsync -a /path/from/ /path/to/ --include \*/ --exclude \*


--include \*/

specifies that all directories should be copied, and

--include \*

specifies that all files should be excluded from the copy.

The beauty of this is that the new directory hierarchy has the same attributes, timestamps, permissions, etc as the original.