Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a large directory tree with lots of files.

I would like to re-create the directory structure in a new location, but only the directories, not the files.

I've checked cp's man page, but don't see an argument that will help.

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted
rsync -av -f"+ */" -f"- *" /.../SOURCE /.../DESTINATION
share|improve this answer
    
can you explain? –  chovy Aug 21 '13 at 6:08
    
This is explained in man rsync (see section "INCLUDE/EXCLUDE PATTERN RULES"). The option -f adds a filter. "+ */" includes all directories, the following "- *" excludes everything else. –  Ansgar Wiechers Aug 21 '13 at 10:46
add comment
find . -type d -exec mkdir -p ~/to/{} \;

Taken from @whitequark's answer to to this question: Copy directory structure without copying files, on Mac OS X

share|improve this answer
    
brilliant. thanks. –  chovy Aug 21 '13 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.