Renames a file or directory in a backup to match a corresponding name change in the filesystem.
$ hb rename [-c backupdir] origpath newpath
If dedup is activated, rename is not that important because HashBackup will usually save renamed objects without using much new backup space, but it will have to read every renamed file. Rename changes the path in the backup to match the path in the filesystem so the next backup will not have to read renamed files again.
Rename is limited to:
- changing the last pathname component
- moving a path to one of its parent directories
- moving a path to a different existing directory
- a combination of these
Examples of renames that work:
/home/jim -> /home/fred
/mnt/data -> /mnt/storage
/home/jim -> /jim
/Users -> /home
/Users/ab -> /xy
Examples of renames that may fail:
/Users/jim -> /home/jim if /home/jim already exists
/Users/jim -> /Users/fred/jim if /Users/fred doesn't already exist
The original path is renamed in ALL versions. If a directory is renamed, all files in it are also renamed.
Unlike the Unix mv command, you have to give the complete new pathname, ie, to move /home/jim to /, use /jim as the newpath, not just /.
It is a good idea to run hb compare after a rename to make sure that the backup matches the filesystem. If compare shows a lot of changed files, with inodes changing, it means that the next backup will have to read the renamed files after all. Enable dedup to minimize the amount of data that has to be re-saved.