Rsync ignore owner, group, time, and perms

rsync

I want to know how use rsync for sync to folders recursive but
I only need to update the new files or the updated files (only the content not the owner, group or timestamp) and I want to delete the files that not exist in the source.

Best Answer

I think you can use the -no- options to rsync to NOT copy the ownership or permissions of the files you're sync'ing.

Excerpt From rsync Man Page

--no-OPTION
       You may turn off one or more implied options by prefixing the option 
       name with "no-".  Not all options may be pre‐fixed  with  a  "no-":  
       only options that are implied by other options (e.g. --no-D, 
       --no-perms) or have different defaults in various circumstances (e.g. 
       --no-whole-file, --no-blocking-io, --no-dirs).  You may specify 
       either the short or the long option name after the "no-" prefix (e.g. 
       --no-R is the same as --no-relative).

       For example: if you want to use -a (--archive) but don’t want -o 
       (--owner), instead of converting -a into -rlptgD, you could specify 
       -a --no-o (or -a --no-owner).

       The order of the options is important:  if you specify --no-r -a, the 
       -r option would end up being turned on,  the opposite  of  -a  
       --no-r.   Note  also  that the side-effects of the --files-from 
       option are NOT positional, as it affects the default state of several 
       options and slightly changes the meaning of -a (see the  --files-from
       option for more details).

Ownership & Permissions

Looking through the man page I believe you'd want to use something like this:

$ rsync -avz --no-perms --no-owner --no-group ...

To delete files that don't exist you can use the --delete switch:

$ rsync -avz --no-perms --no-owner --no-group --delete ....

Timestamps

As for the timestamp I don't see a way to keep this without altering how you'd do the comparison of SOURCE vs. DEST files. You might want to tell rsync to ignore timestamps using this switch:

-I, --ignore-times
       Normally  rsync will skip any files that are already the same size 
       and have the same modification timestamp.  This option turns off this 
       "quick check" behavior, causing all files to be updated.

Update

For timestamps, --no-times might do what you're looking for.

Related Question