Copy directory structure without copying files, on Mac OS X
user@osx:~/from$ find . -type d -exec mkdir -p ~/to/{} \;
user@osx:~/from$ find . -type f -exec ln -s ~/from/{} ~/to/{} \;
or
user@osx:~/from$ find . -type f -exec touch ~/to/{} \;
Try lndir
. From its man page:
The lndir program makes a shadow copy todir of a directory tree
fromdir, except that the shadow is not populated with real files but
instead with symbolic links pointing at the real files in the fromdir
directory tree.
Another solution that works for me is to use rsync
and exclude all files, e.g.
$ rsync -a /path/from/ /path/to/ --include \*/ --exclude \*
The --include \*/
specifies that all directories should be copied, and --exclude \*
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.