Macos – Copy directory structure without copying files, on Mac OS X

file managementmacos

I'd like to duplicate the directory structure in some directory to another, without copying any actual files. In place of the files, I'd like either a blank file with the same name, or a symlink to the original location.

How could I do this, on OS X? Command-line tools (rsync/find/tar/whatever), shell scripts, etc., are all acceptable, software I have to buy probably isn't.

Best Answer

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/{} \;
Related Question