Pages

Monday, June 15, 2009

Ubuntu Tricks: Copy Directory Structure

Looking to create a download staging directory that mimics the actual target after a 2nd phase move, I was at a loss of how to easily do this. Google to the rescue led me to this page. Its not a super elegant solution but it works after a bit of cleanup and is better than having to type it all myself:

# cd /new/dir
# (cd /old/dir; find -type d ! -name .) | xargs mkdir


Nice.

1 comment:

  1. (cd /home/user/source/; find -type d -print0) | xargs -0 mkdir -p

    ReplyDelete