r00fus r00fus - 11 months ago 68
Linux Question

Copy folder structure (sans files) from one location to another

I want to create a clone of the structure of our multi-terabyte file server. I know that cp --parents can move a file and it's parent structure, but is there any way to copy the directory structure intact?

I want to copy to a linux system and our file server is CIFS mounted there.

Answer Source

You could do something like:

find . -type d >dirs.txt

to create the list of directories, then

xargs mkdir -p <dirs.txt

to create the directories on the destination.