copy dirs. subdirs, symlink, but not files

Bill Campbell rsync at celestial.com
Mon May 17 11:41:47 MDT 2010


On Sun, May 16, 2010, aurfalien at gmail.com wrote:
> Hi all,
>
> 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.
>
> 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;

I haven't tried this with rsync, but back in the day when we were
supporting lots of SCO systems with a broken ``tar'' program, I would
create a cpio archive of all non-files to allow quick recovery of the
directory structure, devices, et al.  I used the find command to get
everything under the directory that was not a file.

cd path-to-some-dir
find . ! -type f | cpio ...

If I could ever figure out how rsync works with lists of files or
input from stdin, a similar method should work.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

Microsoft is to computers what Phillip Morris is to lungs.


More information about the rsync mailing list