rsync and cp -r

  • Posted on January 12, 2011 at 16:34

Since I lately had to do a lot of data-migrating stuff, I made myself an alias for rsync and I use it as recursivecopy-command. Works great! Write this down… 🙂

Alias
# alias rcp='rsync --owner --group --perms --times --archive --recursive --progress'

Some advantages

  • No worries about accidentally overwriting important files
  • No struggle with long syntaxis anymore
  • Same syntaxformat as cp
    Example: # rcp -v /home/user1/* /home/user2/*
  • Progress indicator
  • Retaining file permissions and ownerships
  • Very forgiving with interruptions!
    You can hit CTRL-C without any risk. Just restart your rcp-action. And it will continue where it left of…

And sure you can add this alias to the bashrc, the .bash_profile, and so on….

1 Comment on rsync and cp -r

  1. xuedong says:

    useful! when i wanted to copy all the files including hidden files, i found cp -r was not good at doing that, then i heard the rsync, it’s a good tool.

Leave a Reply