I have a directory with lots of large files, that is regularly backed up using rsync on to a different drive.

Now let's say I'd like to rename a directory on the master file system. What rsync seems to do is to re-upload all files from the renamed directory.

Is there a tool that is a simple to use as rsync (i.e. commandline, doesn't require daemons, etc.) that will just rename directory in the target location?


The -H option is intended to preserve all the hardlinks within the rsync'ed hierarchy. The solution is:

cp -al oldname newname
rsync -aH ...
rm -r oldname
rsync -aH --del ...

The other possibility is to manually rename directories on the both sides between the synchronizations.

  • Kondybas, the word "obvious" you used in two places doesn't come across well, it can be interpreted as a mild insult. I have made a small edit to your post. – Tim Jul 3 '17 at 21:13
  • @Tim Thanks man! Only manual renaming is obvious while hardlink trick isn't. – Kondybas Jul 3 '17 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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