copy dirs. subdirs, symlink, but not files

Michael Renner michael.renner at gmx.de
Mon May 17 14:34:30 MDT 2010


On Monday 17 May 2010, aurfalien at gmail.com wrote:
> Hi all,

Moin,


> I've been messing around with needing to duplicate a dir tree minus
> its file contents.
>
> What i would like to achieve is to rsync dirs, subdirs and sym links
> of dirs excluding files.

some time ago I wrote a shell script to clone a file system structure. It does 
not handle symlinks (the idea is good) and was written for solaris. If you 
use Linux you have to ajust the 'ls' order in the scriptpart somehow.

http://www.vbox4php.org/unix/network-and-scripts/clone-directories
http://www.vbox4php.org/unix/network-and-scripts/userclone

Be sure that all the users and group exists at the target side. If not please 
use my script 'userclone' to create them
http://www.vbox4php.org/unix/network-and-scripts/userclone

CU

> My first experiment was to simply do dirs and subdirs;
>
> rsync -a -f"+ */" -f"- *" source destination
>
> Worked like a champ.
>
> However I'm unsure how to include or exclude sym links from this so i
> tried;
>
> rsync -a -f"+ */" -f"- * -l" source destination
>
> Which breaks everything and copies all data, dirs, subdirs, sym links
> and files.
>
> Any ideas?



-- 
|Michael Renner      E-mail: michael.renner at gmx.de  |
|D-81541 Munich      Germany        ICQ: #112280325 |
|Germany             Don't drink as root!      ESC:wq


More information about the rsync mailing list