1

This topic has been covered in other questions (e.g. this one here: On OS X, what files are excluded by rule from a Time Machine backup? ). However, due to the significant changes in the latest versions of the Mac OS, most of it is no longer valid. As an example, a built-in list of exclusions is no longer stored in /System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist

Allow me therefore to pose the question again.

Using the System Settings way I am not able to add the Trash folder to the exclusion list because it does not show in the home folders list:

enter image description here

Is there another way to add it? Or is it already excluded by default?

I have tried to run tmutil isexcluded ~/.trash and I get [Excluded] /System/Volumes/Data/Users/username/.trash, but I don't know if I can trust it because if I run it for the Desktop in two different manners, I get two contradicting results:

tmutil isexcluded ~/desktop returns [Included] /System/Volumes/Data/Users/username/desktop

while tmutil isexcluded /Users/username/Desktop returns [Excluded] /System/Volumes/Data/Users/username/Desktop

I did sudo tmutil addexclusion -p /system/volumes/data/Users/username/.trash but this did not add Trash in GUI:

enter image description here

[EDITED Feb 26]: I am not sure how much to trust the system. As you can see from the screenshot above, I have excluded the Desktop. However, it seems that it is still being backed up. To test it, yesterday I have placed a file directly on the desktop and another one inside a folder. Today, when browsing the Time Machine backups, I can see that they have all been backed up, regardless of the exclusion:

enter image description here

Jerry_D
  • 306
  • 2
    Case shouldn't matter, I get "excluded" for both .trash and .Trash, "included" for both "desktop" and "Desktop". – nohillside Feb 24 '23 at 13:03
  • I agree, the case should not matter, but apparently in my case it does (Mac Mini M2 Pro, Ventura 13.2.1). First I thought it was the two ways to write the path, but when testing both and just changing the case of the letter D in Desktop, I get two different results. I even managed to add it twice to the GUI list by using tmutil addexclusion once with Desktop and once with desktop (as you can see in the image above) – Jerry_D Feb 24 '23 at 14:22
  • 1
    You can even add non-existing paths via tmutil addexclusion, so I would focus on using tmutil isexcluded with paths which actually exist. – nohillside Feb 24 '23 at 14:30
  • The Desktop folder exists and it can be referenced both as System/Volumes/Data/Users/username/desktop and as ~/desktop. Both are correct existing paths pointing to the same folder. However, tmutil isexcluded treats them as different. That is the point I was making. My apologies for not being totally clear. – Jerry_D Feb 24 '23 at 15:30
  • Why? What make you think that ~/.Trash is backed up by TM? Mine isn't. – Gilby Feb 25 '23 at 02:12
  • Your examples for desktop are for two different folders. Do you have a desktop as well as Desktop? I only have Desktop. – Gilby Feb 25 '23 at 02:24
  • File/dir names are not case-sensitive in the GUI (unless you formatted the volume to be case-sensitive). But any shell command from BSD is case-sensitive unless Apple added case-folding. That might even Apply to Apple-provided executables that contain borrowed code. – WGroleau Feb 25 '23 at 22:00

1 Answers1

1

Trash folders are not backed up by Time Machine. So there is no need to add any trash folders to the exclusions.

As you have already discovered with tmutil isexcluded ~/.trash the trash folder in your home directory is excluded.

But you can also look in the backup.

If your Finder shows ~/.trash (with view hidden files enabled), you can navigate to your home folder in a TM backup. There is no .trash folder in the backup.

If Finder doesn't show ~/.trash:

  1. Navigate to your backup in Finder and find your home folder;
  2. Control-click and Option select Copy ... as Pathname;
  3. In Terminal use ls -lah and paste the path.

That will show that the trash is not present in the backup.

Gilby
  • 10,852
  • The last sentance is not that useful - you can't see ~/.Trash in Finder as it hodes the directory you need to use the Terminal to see it and then use the Terminal tto see it is not in the backup. – mmmmmm Feb 25 '23 at 07:12
  • @mmmmmm Interesting point. On one of my Macs I can see ~/.trash in Finder. On my other Mac it is invisible even when view hidden files and folders is enabled (shift-command-dot). Do you know the reason for that? – Gilby Feb 25 '23 at 09:58
  • what versions of macOS - this is a new feature – mmmmmm Feb 25 '23 at 10:04
  • @mmmmmm 13.2.1 and 13.2 – Gilby Feb 25 '23 at 21:02