MacOS – RSYNC recursive over Time Machine Backups identify unique files

macosrsynctime-machine

i have an issue with my Time Machine Backup. To fix the mess i thought about waling recursively over all TimeMachine Backup folders.

Oldest Backup
RSYNC to NEW_TARGET

Recursively go over every Backup folder (Oldest Backup +x Days) and only copy files which don't exist on NEW_TARGET.

But there's a pitfall. The folder names got changed so:

"insurances"

in the Oldest Backup Folder might be renamed to

"insurences new"

on a more recent backup folder but might contain a lot of same files AND NEW files. So i'm looking for a solution which could handle renamed folders in some way.

I hope someone has a clue how to achieve a solution.

Chris

Best Answer

Modifying Time Machine back-ups directly is difficult. Time Machine uses hard links and other tricks to work. So probably best to try and reconstruct the contents on a new drive.

I would divide the problem into parts:

  • Fix the folder names
  • Merge the folder contents

Renaming

You can automate the renaming of files and folders matching specific patterns. See Rename multiple files by replacing a particular pattern in the filenames using a shell script for a collection of approaches.

You could also use AppleScript or Automator for this task, if you need more involved logic.

Merging

rsync is probably a good starting point for extracting the contents from the Time Machine drive:

If rsync does not quite provide enough for your needs, consider unison.

unison is designed to keep folders synchronised, with the merging taking care to ensure the destination contains only the latest files. Unison can be used on local folders.