rsync prevent destination only new folders but need new files

Kevin Korb kmk at sanitarium.net
Wed Nov 12 22:34:06 MST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The only way I can think of to do that would be to use find -type d on
the target to generate a list of directories that pre-exist then use
that as an include list before an exclude of */  So, something like:

cd /destination
echo '- .git' > /tmp/filelist
find . -type d -print | sed -e 's/^./+ /' >> /tmp/filelist
echo '- */' >>> /tmp/filelist
rsync -anvi --exclude-from=/tmp/filelist --progress source/ destination/

You will notice that I changed your options a little bit...
- -t is included in -a and you will probably find -i to be more useful
than the second (or even the first) -v.  Though -vv is still useful
when debugging exclude/include.

On 11/13/2014 12:26 AM, charith wrote:
> Good day to all!
> 
> I'm doing git file replication task and need to sync source
> destination, using below sync command.
> 
> rsync -atnvv --existing --exclude '.git' --progress source/
> destination/;
> 
> Here I,
> 
> 1) need  only sync directories that *exist on destination* ,no new 
> folders should copy from source - [used  --existing did the job but
> it not copying new files also.]
> 
> 2) need to copy *new files *on source  directory to destination.
> 
> Thanks in advance Charith.
> 
> 
> 
> 
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlRkQs4ACgkQVKC1jlbQAQd+KQCgwyGY2znfV/WlAbQJhZted8Kq
k7MAni1Psfd5xJUWWZRtJVqxhTigmFY8
=4XJq
-----END PGP SIGNATURE-----


More information about the rsync mailing list