Create duplicate directories with same permissions

Hi all,

I need to create duplicate directories and sub directories (only the directories not the files or file contents) with the same permissions. Can some one guide me in doing this. I could able to create but here the permissions should be the same how can i do this in linux.

Thanks in advance. Quick response is highly appreciated. Thank you so much.

Regards,
Olivia

cp -ar DIR NEWDIR
find NEWDIR -type f -print0 | xargs -0 rm

I'm interested in a better solution too.

rsync -vrz --copy-links --stats --exclude="*" $SOURCE/* $DESTINATION
1 Like

It doesn't work:

$ mkdir -p a/{b,c,d} x
$ rsync -vrz --copy-links --stats --exclude="*" a/* x
...
$ ls x

nothing

hmm, exclude flag is used to exclude the matching filenames. so i have given *.

i didnt verify the command

rsync -a -f"+ */" -f"- *" source/ destination/

Ref: Copying directory trees with rsync -- I Still Know What You Learned Last Summer