//View Tip #171
Similar Tips
» Find last modified files on a filesystem
» Add a line to files using find and echo
» Stream YouTube videos directly to your media player
» Finding log files X number of days old and deleteing them.
» Mass-renaming files

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
The following command creates in the /usr/project directory, a copy of the current working directory structure:

find . -type d -print|sed 's@^\.\{0,1\}@/usr/project@' | sed 's/ /\\ /' | xargs mkdir -p


View Comments »




Comments 

Add your comment

Comments are currently disabled
This could be simplified a bit:

find . -type d -print | cpio -pudmv /usr/project

That accomplishes the same thing with no string manipulation required.
Posted 2009-12-11 14:22:43

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit