Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I used rsync for creating a backup copy:

bash-3.2$ rsync -tvrog /export/home/kent/Scripts /export/home/kent/TEST_Scripts_rsync

With these options:

Options:
      -v, --verbose               increase verbosity
      -r, --recursive             recurse into directories
      -o, --owner                 preserve owner (super-user only)
      -g, --group                 preserve group

Observe the Source directory contents:

bash-3.2$ cd /export/home/kent/Scripts
bash-3.2$ ls -l
total 170
-rw-r--r--   1 kent   kent        74 Feb  5 07:10 1.sh
drwxr-xr-x   2 kent   kent         2 Jun 17 06:21 456
-rwxrwxrwx   1 kent   kent       355 Feb  5 07:10 App_recreate.msh
...

Destination:

bash-3.2$ cd TEST_Scripts_rsync/Scripts/
bash-3.2$ ls -l
total 168
-rw-r--r--   1 kent   kent        74 Feb  5 07:10 1.sh
drwxr-xr-x   2 kent   kent         2 Jun 17 06:21 456
-rwxr-xr-x   1 kent   kent       355 Feb  5 07:10 App_recreate.msh
...

Note that the permissions have changed for App_recreate.msh. So is there a way to preserve the permissions at the least if not also preserve the last modified date?

Note that I traversed all the directories from / to /export/home/kent/ but couldn't find a sticky bit that might be responsible for masking the permissions.


Note:

  • Once done, I may have to do an incremental backup using rsync - so I guess simply tar-ing the files wouldn't be of much help.
share|improve this question

1 Answer 1

up vote 6 down vote accepted

Add the --perm ( or -p ) option. The manpages are your friend.

share|improve this answer
    
thanks! Can't believe I missed it.. –  Kent Pawar Jun 21 '13 at 17:34
5  
@KentPawar Most of the time you just want -a, which covers -rlptgoD. –  jordanm Jun 21 '13 at 18:31
    
Thanks @jordanm - will try that –  Kent Pawar Jun 22 '13 at 2:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.