Hi,
I want to specify multiple remote directories but want to transfer them in a single command with one connection with remote server. This avoids entering passwords repeatedly and is also efficient.
e.g.
rsync -vrt --size-only --delete user@host:/home/user1/dir1 user@host:/home/user1/dir2 user@host:/home/user1/dir3 .... local_dir/
I want to transfer dir1, dir2 and dir3 using the same connection. The above command will establish 3 connections. Is there way to achieve this?
rsync -vrt --size-only --delete user@host:/home/user1/dir1,/home/user1/dir2,/home/user1/dir3 local_dir/
thanks,
Sam
Why not rsync on the home directory directly?
rsync -vrt --size-only --delete user@host:/home/user1
because I need to sync specific directories dir1, dir2.. under user1/.
why dont you prefer scp command !
---------- Post updated at 06:05 AM ---------- Previous update was at 06:02 AM ----------
Asking for that sake of curiosity , is there any special reason for choosing rsync , please
tell me that if any!
If you push the files from remote server, you just need one connection
ssh remote server
I'm not sure if the --delete option will work in this case
abubacker:
why dont you prefer scp command !
---------- Post updated at 06:05 AM ---------- Previous update was at 06:02 AM ----------
Asking for that sake of curiosity , is there any special reason for choosing rsync , please
tell me that if any!
rsync has significant advantages over scp. What if each directory is 5 GB and the changes since last time you updated were only 1 KB ?
---------- Post updated at 03:34 PM ---------- Previous update was at 03:34 PM ----------
funksen:
If you push the files from remote server, you just need one connection
ssh remote server
I'm not sure if the --delete option will work in this case
No I don't want to ssh to remote server. This will not work.
Thanks for your explanation Sardare
So i guess there is no solution to this problem. Have to do it in separate commands and multiple connections and multiple password entries. This SUCKS!
Looks like this is something that should be added to rsync functionality..
should be possible with
--exclude-from=FILE1
--include-from=FILE2
perhaps
specify the whole home directory to be synced
then exclude /home, and include /home/dir1, /home/dir2, /home/dir2
never tried this, but might work
Dratir
March 19, 2010, 9:40am
10
Try this:
rsync -vrt --size-only --delete user@host:/home/user1/{dir1,dir2,dir3} local_dir/
Worked in my case...