Jump to content

rsync parameters to copy new/modified files


mga_ka_php

Recommended Posts

can rsync copy only new and modified files only?

 

i want to backup my website and copy only the updated and new files because we have an account which is almost 3GB and if i do full backup that regularly it will eat so much storage space and long load for both servers.

 

how do i accomplish that?

 

can you specify the parameters to be used.

 

Thanks.

Link to comment
Share on other sites

The best place to start is always a man page:

 

http://www.manpagez.com/man/1/rsync/

 

What you are describing is essentially the default behavior of rsync, but your best bet would be to use -a, so your rsync would look like this:

 

rsync -e ssh -avz --delete-after /path/to/stuff user@slave:/path/to

 

-e Specifies the files will be sent through SSH

-avz

This is a combination of 3 options.  The "-a" means archive.  This will preserve symlinks, permissions, timestamps, group/owners, and will be recursive. The "v" makes the job verbose.  This won't be necessary, but you can see what's happening with the rsync so you know if you've done something wrong.  The "z" compresses data to speed up the transfer.

 

--delete-after Will tell rsync to compare the destination against the source and delete any extraneous files after the rsync has completed.  This is a dangerous option, so use with caution.

 

I would recommend doing a dry-run before actually running any commands on your production environment, to do this, just throw an "n" into the command:

 

rsync -e ssh -avzn --delete-after /path/to/stuff user@slave:/path/to

 

This will spit out what rsync _would_ do, but doesn't actually copy anything.

 

--

Vincent Gerbino

HostMySite Technical Support, Manager

vinny@hostmysite.com

http://www.HostMySite.com?utm_source=bb

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.