scp and rsync timestamp

ARUN Posted in GENERAL RULES, RSYNC
0

When a file is scp to a remote server, the time stamp of the file in remote server will be changed and hence the file will be created with new date and time.

When we rsync a file or a folder, time stamp will also be copied to new server.

ie. when a file created on jan 1st is moved to a remote server using rsync, then the remote server will show Jan 1st as the file creation date and not the new date.

General rsync command

ARUN Posted in RSYNC
0

[   rsync -e ssh -az --progress /home/arun/Desktop/ 192.168.1.99:/home/arun/Desktop/     ]

[  rsync -avz -e “ssh -p $portNumber” /local/path/  [email protected]:/path/to/files/    ]

Make sure to put the last  ” / ” and if it is not there then the destination server will have  /home/arun/Desktop/Desktop  folder instead.

Local rsync

rsync -avvz /home/aaron/Desktop/source/ /home/aaron/Desktop/destination/

EXCLUDE ***

rsync -avvz /home/aaron/Desktop/source/ /home/aaron/Desktop/destination/ –exclude=movies/sandhuz

All files under  “source” will be transferred to “destination” and it will keep all files under folder “destination” the intact.

 rsync -avvz –log-file=/tmp/log.txt –exclude=/proc -e ssh / u[email protected]:/home/username/

Another example

[  rsync -avvz --log-file=/home/arun/rsync_log.txt /home/arun/ [email protected]:/home/arun/ --exclude=public_html/cache  ]

 

Note : 

[    --progress   or  -w switch will  show the speed of transfer   ]