Copy only folder structure ?

Hello,

I am not sure how feasible is it, but trying to copy/create the folders from one box to another. I dont want to copy the content of folder otherwise it'd be too much of data..

The folder structure is quite complex (in deep hierarchy) and its a big effort manually ..

Please suggest

Thanks in Advance

Do you want to copy , preserve file mode, time , ownership or just re-create the same hierarchy ?

If you only want to copy the directory structure you can try this:

cd source_dir
find . -type d -depth | cpio -dumpl destination_dir

Regards

If you have rsync:

rsync -avz -e ssh --include '*/' --exclude '*' local_source_dir user@host:/dest_dir

Use --dry-run to test.

Yet another one:

cd destination/dir
find /source/dir -type d -printf "%P\n" | xargs mkdir -p

Be extremely careful not to overwrite source dir. Make few test first in /tmp

Thanks Everyone..

Pretty Cool Solutions ...

I love Unix.com