Copying directories structure without te files inside


I want to copy a full and complex directory structure into another directory but without copying any file. The ONLY thing I want to copy is directory structure, one the same as I created some time.

I was reviewing the man of cp command but I didn’t see anything there.

Any other suggestion, please ?

Thanks in advance fo any feedback,



cd to the directory you want to copy the directory structure from and;

find ./ -type d -exec mkdir -- /destination/directory/{} \;

So for example you want to copy the structure of /root/meow to /tmp/woof/

cd /root/meow
find ./ -type d -exec mkdir -- /tmp/woof/{} \;

Oughta do the job. Just popped into my mind :stuck_out_tongue:

Good idea. Are we sure that find gives the directories in hierarchical sequence? If not use mkdir -p instead of mkdir.

Good point hcvv, I assumed (the bad start to everything?) that find would traverse the directories in a sequential order.

I did a quick test. As far as I can see it is hierarchical, thus the -p option is not needed. But it does not hurt of course.


find "$source" -type d -print | pax -rwdv "$destination"

or if you don’t like pax you can use cpio

find "$source" -type d -print | cpio -pdumv "$destination"


you might need to cd to the source directory to avoid copying the parent directory (unless that is intended) which is done in my previous post.


I am using a subshell ( and** )** so you don’t have to worry about going to the directory you are in after the command is done

( cd "$source" && find . -type d -print | pax -rwdv "$destination" )


( cd "$source" && find . -type d -print | cpio -pdumv "$destination" )