copy dirs. subdirs, symlink, but not files

aurfalien at aurfalien at
Mon May 17 13:38:36 MDT 2010

On May 17, 2010, at 10:41 AM, Bill Campbell wrote:

> On Sun, May 16, 2010, aurfalien at 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 ...

Hi Bill,

Well, find + cpio combo have always been trusted friends of mine so  
I'll use them instead.

Besides, philosophically, rsync wouldn't be the right tool in my case  
as no target exists yet.

Also, find had a -type for sym links.  Thanks for the reply.

More information about the rsync mailing list