Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Group duplicates by their bytes and keep the copy with tags

Țugui Dragoșd36c22980571
diff --git a/GUIDE.md b/GUIDE.md
index 5e80bf91..8eaa2345 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -113,15 +113,16 @@ Space shows what fills your disk, area by area, and what each area is.
changed in the last 7 days.
- **Duplicates:** files and whole folders with identical contents, compared with SHA-256. Unless you choose folders,
it looks in Desktop, Documents, Downloads, Pictures, Movies, and Music. Files under 100 KB, and folders holding
- less, are left out unless you choose a smaller size, in the app and in `peel duplicates` alike. Copies whose Finder
- tags, Finder comment, or resource fork differ aren't listed together, since moving the copy that has them would lose
- them. After a scan you start, Peel selects every copy in each group but the first, which it suggests keeping: one
- outside Downloads, then one whose name doesn't end like a copy's, such as `photo copy.jpg` or `photo (1).jpg`, then
- one on the disk your home folder is on, then the oldest. Look before you move them: one copy is always kept. A copy
- in a folder that syncs to your other devices, such as iCloud Drive or what Desktop and Documents hold when they are
- in iCloud, is listed and never moved, since the Trash would take it from your other devices too: beside a copy on
- this Mac it is marked Stays, and a group whose every copy syncs is listed under Synced to Other Devices. A chosen
- folder Peel doesn't scan, such as a repository, is named with why, in Scan Settings and with the result.
+ less, are left out unless you choose a smaller size, in the app and in `peel duplicates` alike. A copy with Finder
+ tags, a Finder comment, or a resource fork the others lack is marked Stays and never moved, since moving it would
+ lose them, and the others can all go. After a scan you start, Peel selects every copy in each group but the first,
+ which it suggests keeping: one outside Downloads, then one whose name doesn't end like a copy's, such as
+ `photo copy.jpg` or `photo (1).jpg`, then one on the disk your home folder is on, then the oldest. Look before you
+ move them: one copy is always kept. A copy in a folder that syncs to your other devices, such as iCloud Drive or
+ what Desktop and Documents hold when they are in iCloud, is listed and never moved, since the Trash would take it
+ from your other devices too: beside a copy on this Mac it is marked Stays, and a group whose every copy syncs is
+ listed under Synced to Other Devices. A chosen folder Peel doesn't scan, such as a repository, is named with why, in
+ Scan Settings and with the result.
- **Installers and Backups:** disk images and packages in Downloads, Desktop, Documents, Public, and Shared, and in
the folders directly inside them, where installers are usually left, with archives there that hold an app or an
installer. It also lists packages an app keeps in Application Support, macOS installers there and in the folders
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index f4ebdb12..ba63af8c 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -78920,6 +78920,113 @@
}
}
},
+ "Left alone: this copy has Finder tags, a Finder comment, or a resource fork the others don’t, which moving it would lose." : {
+ "comment" : "The reason beside a copy in Duplicates that Peel never moves: it has Finder tags, a comment written in Finder's Get Info, or a resource fork, which the other copies of the same file don't have.",
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nedotčeno: tato kopie má značky Finderu, poznámku Finderu nebo prostředkovou část, které ostatní nemají, a jejím přesunutím by se ztratily."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Unangetastet: Anders als die übrigen Kopien hat diese Finder-Tags, einen Finder-Kommentar oder einen Resource-Fork, die beim Verschieben verloren gingen."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se toca: esta copia tiene etiquetas del Finder, un comentario del Finder o una bifurcación de recursos que las demás no tienen, y que se perderían al trasladarla."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Laissé en place : cette copie possède des tags du Finder, un commentaire du Finder ou une branche de ressources que les autres n’ont pas, et que son déplacement ferait perdre."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Resta dov’è: questa copia ha tag del Finder, un commento del Finder o un resource fork che le altre non hanno, e che andrebbero persi spostandola."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "対象外: このコピーには、ほかのコピーにないFinderのタグ、Finderのコメント、またはリソースフォークがあり、移動するとそれらが失われます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "그대로 둠: 이 복사본에는 다른 복사본에 없는 Finder 태그, Finder 설명 또는 자원 포크가 있으며, 이동하면 이를 잃게 됩니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Blijft staan: deze kopie heeft Finder-tags, een Finder-opmerking of een resourcefork die de andere kopieën niet hebben, en die zouden verloren gaan als je deze kopie verplaatst."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nietknięte: ta kopia ma tagi Findera, komentarz Findera lub część zawierającą zasoby, których nie mają pozostałe kopie, więc jej przeniesienie oznaczałoby ich utratę."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Preservado: esta cópia tem etiquetas do Finder, um comentário do Finder ou uma bifurcação de recursos que as outras não têm, e isso se perderia se ela fosse movida."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lăsat neatins: această copie are etichete Finder, un comentariu Finder sau o ramură de resurse pe care celelalte nu le au, iar prin mutarea ei acestea s‑ar pierde."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Остается на месте: у этой копии есть теги Finder, комментарий Finder или ветвь ресурсов, которых нет у других копий, и при перемещении они были бы потеряны."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Rörs inte: den här kopian har Finder-taggar, en Finder-kommentar eller en resursdel som de andra inte har, och de skulle gå förlorade om kopian flyttades."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yerinde kalır: bu kopyada diğerlerinde olmayan Finder etiketleri, Finder açıklaması veya kaynak yazılım çatalı var ve kopya taşınırsa bunlar kaybolur."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Лишається на місці: ця копія має теги Finder, коментар Finder або гілку ресурсів, яких немає в інших, і якби її перемістили, їх було б утрачено."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "留在原处:此副本带有其他副本没有的访达标签、访达注释或资源分支,移动它会丢失这些信息。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "原地保留:此副本有其他副本沒有的Finder標籤、Finder註解或resource fork,移動它就會失去這些內容。"
+ }
+ }
+ }
+ },
"Left alone: this syncs to your other devices through iCloud or another app, and moving it to the Trash would also remove it from them." : {
"localizations" : {
"cs" : {
@@ -158327,6 +158434,220 @@
}
}
},
+ "Selected copies go to the Trash. A copy marked Stays has Finder tags, a Finder comment, or a resource fork the others don’t, and is never moved." : {
+ "comment" : "The note behind the circled i of Copies in Duplicates, when one copy stays for its Finder tags, Finder comment, or resource fork. Stays is the badge on that copy's row.",
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vybrané kopie se přesunou do koše. Kopie označená jako „Zůstává“ má značky Finderu, poznámku Finderu nebo prostředkovou část, které ostatní nemají, a nikdy se nepřesune."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ausgewählte Kopien werden in den Papierkorb gelegt. Eine mit „Bleibt“ markierte Kopie hat, anders als die übrigen, Finder-Tags, einen Finder-Kommentar oder einen Resource-Fork und wird nie verschoben."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Las copias seleccionadas van a la papelera. Una copia marcada como “Se queda” tiene etiquetas del Finder, un comentario del Finder o una bifurcación de recursos que las demás no tienen, y nunca se traslada."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Les copies sélectionnées sont placées dans la corbeille. Une copie marquée « Reste en place » possède des tags du Finder, un commentaire du Finder ou une branche de ressources que les autres n’ont pas, et n’est jamais déplacée."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Le copie selezionate vanno nel Cestino. Una copia contrassegnata con “Resta” ha tag del Finder, un commento del Finder o un resource fork che le altre non hanno, e non viene mai spostata."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選択したコピーはゴミ箱に入ります。“移動しない”と表示されたコピーには、ほかのコピーにないFinderのタグ、Finderのコメント、またはリソースフォークがあるため、決して移動されません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택한 복사본은 휴지통으로 이동합니다. ‘남음’으로 표시된 복사본에는 다른 복사본에 없는 Finder 태그, Finder 설명 또는 자원 포크가 있으며, 절대 이동되지 않습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Geselecteerde kopieën gaan naar de prullenmand. Een kopie met de markering 'Blijft staan' heeft Finder-tags, een Finder-opmerking of een resourcefork die de andere kopieën niet hebben, en wordt nooit verplaatst."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zaznaczone kopie trafiają do Kosza. Kopia oznaczona jako „Zawsze zostaje” ma tagi Findera, komentarz Findera lub część zawierającą zasoby, których nie mają pozostałe kopie, a Peel nigdy jej nie przenosi."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "As cópias selecionadas vão para o Lixo. Uma cópia marcada como “Permanece” tem etiquetas do Finder, um comentário do Finder ou uma bifurcação de recursos que as outras não têm, e nunca é movida."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copiile selectate sunt mutate în Coș. O copie marcată cu „Rămâne pe loc” nu este mutată niciodată: are etichete Finder, un comentariu Finder sau o ramură de resurse pe care celelalte nu le au."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выбранные копии перемещаются в Корзину. У копии с пометкой «Остается» есть теги Finder, комментарий Finder или ветвь ресурсов, которых нет у других копий, и она никогда не перемещается."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Markerade kopior flyttas till papperskorgen. En kopia märkt ”Stannar kvar” har Finder-taggar, en Finder-kommentar eller en resursdel som de andra inte har, och flyttas aldrig."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seçili kopyalar Çöp Sepeti’ne gider. “Kalıyor” olarak işaretlenmiş bir kopya, diğerlerinde olmayan Finder etiketlerine, Finder açıklamasına veya kaynak yazılım çatalına sahiptir ve hiçbir zaman taşınmaz."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вибрані копії переміщуються в Смітник. Копія з позначкою «Лишається на місці» має теги Finder, коментар Finder або гілку ресурсів, яких немає в інших, і Peel ніколи її не переміщує."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "所选副本会移到废纸篓。标记为“保持原位”的副本带有其他副本没有的访达标签、访达注释或资源分支,绝不会被移动。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選取的副本會丟到「垃圾桶」。標示為「留在原處」的副本有其他副本沒有的Finder標籤、Finder註解或resource fork,絕不會被移動。"
+ }
+ }
+ }
+ },
+ "Selected copies go to the Trash. A copy marked Stays syncs to your other devices, or has Finder tags, a Finder comment, or a resource fork the others don’t, and is never moved." : {
+ "comment" : "The note behind the circled i of Copies in Duplicates, when one copy syncs to other devices and one stays for its Finder tags, Finder comment, or resource fork. Stays is the badge on those copies' rows.",
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vybrané kopie se přesunou do koše. Kopie označená jako „Zůstává“ se synchronizuje s vašimi ostatními zařízeními nebo má značky Finderu, poznámku Finderu či prostředkovou část, které ostatní nemají, a nikdy se nepřesune."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ausgewählte Kopien werden in den Papierkorb gelegt. Eine mit „Bleibt“ markierte Kopie wird mit deinen anderen Geräten synchronisiert oder hat, anders als die übrigen, Finder-Tags, einen Finder-Kommentar oder einen Resource-Fork und wird nie verschoben."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Las copias seleccionadas van a la papelera. Una copia marcada como “Se queda” se sincroniza con tus otros dispositivos, o tiene etiquetas del Finder, un comentario del Finder o una bifurcación de recursos que las demás no tienen, y nunca se traslada."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Les copies sélectionnées sont placées dans la corbeille. Une copie marquée « Reste en place » est synchronisée avec vos autres appareils, ou possède des tags du Finder, un commentaire du Finder ou une branche de ressources que les autres n’ont pas, et n’est jamais déplacée."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Le copie selezionate vanno nel Cestino. Una copia contrassegnata con “Resta” si sincronizza con gli altri tuoi dispositivi, oppure ha tag del Finder, un commento del Finder o un resource fork che le altre non hanno, e non viene mai spostata."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選択したコピーはゴミ箱に入ります。“移動しない”と表示されたコピーは、ほかのデバイスに同期されているか、ほかのコピーにないFinderのタグ、Finderのコメント、またはリソースフォークがあるため、決して移動されません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택한 복사본은 휴지통으로 이동합니다. ‘남음’으로 표시된 복사본은 다른 기기와 동기화되거나 다른 복사본에 없는 Finder 태그, Finder 설명 또는 자원 포크를 가지고 있으며, 절대 이동되지 않습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Geselecteerde kopieën gaan naar de prullenmand. Een kopie met de markering 'Blijft staan' wordt gesynchroniseerd met je andere apparaten of heeft Finder-tags, een Finder-opmerking of een resourcefork die de andere kopieën niet hebben, en wordt nooit verplaatst."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zaznaczone kopie trafiają do Kosza. Kopia oznaczona jako „Zawsze zostaje” jest synchronizowana z Twoimi pozostałymi urządzeniami albo ma tagi Findera, komentarz Findera lub część zawierającą zasoby, których nie mają pozostałe kopie, a Peel nigdy jej nie przenosi."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "As cópias selecionadas vão para o Lixo. Uma cópia marcada como “Permanece” é sincronizada com os seus outros dispositivos ou tem etiquetas do Finder, um comentário do Finder ou uma bifurcação de recursos que as outras não têm, e nunca é movida."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Copiile selectate sunt mutate în Coș. O copie marcată cu „Rămâne pe loc” nu este mutată niciodată: se sincronizează pe celelalte dispozitive ale dvs. sau are etichete Finder, un comentariu Finder ori o ramură de resurse pe care celelalte nu le au."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выбранные копии перемещаются в Корзину. Копия с пометкой «Остается» синхронизируется с другими Вашими устройствами либо имеет теги Finder, комментарий Finder или ветвь ресурсов, которых нет у других копий, и никогда не перемещается."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Markerade kopior flyttas till papperskorgen. En kopia märkt ”Stannar kvar” synkroniseras till dina andra enheter eller har Finder-taggar, en Finder-kommentar eller en resursdel som de andra inte har, och flyttas aldrig."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seçili kopyalar Çöp Sepeti’ne gider. “Kalıyor” olarak işaretlenmiş bir kopya, diğer aygıtlarınızla eşzamanlanır veya diğerlerinde olmayan Finder etiketlerine, Finder açıklamasına ya da kaynak yazılım çatalına sahiptir ve hiçbir zaman taşınmaz."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вибрані копії переміщуються в Смітник. Копія з позначкою «Лишається на місці» синхронізується з іншими вашими пристроями або має теги Finder, коментар Finder чи гілку ресурсів, яких немає в інших, і Peel ніколи її не переміщує."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "所选副本会移到废纸篓。标记为“保持原位”的副本会同步到你的其他设备,或带有其他副本没有的访达标签、访达注释或资源分支,绝不会被移动。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選取的副本會丟到「垃圾桶」。標示為「留在原處」的副本會與你的其他裝置同步,或有其他副本沒有的Finder標籤、Finder註解或resource fork,絕不會被移動。"
+ }
+ }
+ }
+ },
"Selected copies go to the Trash. Peel always keeps at least one." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index 73c9a835..60a05fd0 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -705,7 +705,7 @@ struct DuplicatesCommand: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "duplicates",
abstract: "Find folders and files with identical contents.",
- discussion: "Without folders, Peel scans Desktop, Documents, Downloads, Pictures, Movies, and Music. The first copy of each group is the one Peel suggests keeping. A copy in a folder that syncs to your other devices, such as iCloud Drive, is listed as one that stays and is never moved. A folder is a copy of another only when every file under it matches, so what a folder already speaks for isn't listed again on its own."
+ discussion: "Without folders, Peel scans Desktop, Documents, Downloads, Pictures, Movies, and Music. The first copy of each group is the one Peel suggests keeping. A copy in a folder that syncs to your other devices, such as iCloud Drive, is listed as one that stays and is never moved, and so is a copy with Finder tags, a Finder comment, or a resource fork the others lack, which keeps the bytes for them, so the others can all go. A folder is a copy of another only when every file under it matches, so what a folder already speaks for isn't listed again on its own."
)
@Argument(help: "Folders to scan.", completion: .directory)
@@ -727,10 +727,12 @@ struct DuplicatesCommand: AsyncParsableCommand {
struct Record: Encodable {
let size: Int64
let reclaimableSize: Int64
- /// The copies that may move, the kept one first.
+ /// The copies that may move, the kept one first unless a copy in `stays` keeps the bytes.
let files: [String]
/// The copies that sync to other devices, listed and never moved.
let synced: [String]
+ /// The copies with Finder tags, a Finder comment, or a resource fork the others lack, never moved.
+ let stays: [String]
}
struct FolderRecord: Encodable {
@@ -803,7 +805,7 @@ struct DuplicatesCommand: AsyncParsableCommand {
}
for group in scan.groups {
Output.line(Self.heading(for: group))
- Output.table(Self.rows(for: group.files), indent: " ")
+ Output.table(Self.rows(for: group), indent: " ")
}
let total =
scan.groups.reduce(0) { $0 + $1.reclaimableSize }
@@ -830,10 +832,16 @@ struct DuplicatesCommand: AsyncParsableCommand {
)
}
notes += scan.skippedLocations.map { "Peel didn't look in \(Output.path($0.url)): \($0.reason.summary)." }
- let synced = scan.groups.reduce(0) { total, group in total + group.files.count { $0.heldBack != nil } }
+ let synced = scan.groups.reduce(0) { total, group in total + group.files.count { $0.heldBack == .inTheCloud } }
if synced > 0 {
notes.append("\(Output.count(synced, "copy syncs", "copies sync")) to your other devices, so Peel lists them as copies that stay and never moves them.")
}
+ let staying = scan.groups.reduce(0) { total, group in
+ total + group.files.count { $0.heldBack == .keepsWhatTheOthersLack }
+ }
+ if staying > 0 {
+ notes.append("\(Output.count(staying, "copy has", "copies have")) Finder tags, a Finder comment, or a resource fork the others lack, so Peel lists them as copies that stay and never moves them.")
+ }
return notes
}
@@ -852,7 +860,8 @@ struct DuplicatesCommand: AsyncParsableCommand {
size: group.size,
reclaimableSize: group.reclaimableSize,
files: group.movableFiles.map { Output.path($0.url) },
- synced: group.files.filter { $0.heldBack != nil }.map { Output.path($0.url) }
+ synced: group.files.filter { $0.heldBack == .inTheCloud }.map { Output.path($0.url) },
+ stays: group.files.filter { $0.heldBack == .keepsWhatTheOthersLack }.map { Output.path($0.url) }
)
},
unreadableLocations: scan.unreadableLocations.map(Output.path),
@@ -885,11 +894,11 @@ struct DuplicatesCommand: AsyncParsableCommand {
copies.enumerated().map { index, url in [index == 0 ? "keep" : "", Output.path(url)] }
}
- /// One row per copy of a file: the first copy that may move is marked "keep", one that syncs to other devices
- /// "stays", since Peel lists it and never moves it.
- static func rows(for files: [DuplicateFile]) -> [[String]] {
- let kept = files.first { $0.heldBack == nil }?.url
- return files.map { file in
+ /// One row per copy of a file: one Peel never moves is marked "stays", and the first that may move "keep",
+ /// unless a copy that stays keeps the bytes and every other may go.
+ static func rows(for group: DuplicateGroup) -> [[String]] {
+ let kept = group.holdsACopyWithWhatOthersLack ? nil : group.movableFiles.first?.url
+ return group.files.map { file in
[file.heldBack != nil ? "stays" : file.url == kept ? "keep" : "", Output.path(file.url)]
}
}
@@ -901,7 +910,7 @@ struct DuplicatesCommand: AsyncParsableCommand {
refusals: RefusalLog = RefusalLog()
) async throws {
let folders = scan.folderGroups.flatMap { $0.folders.dropFirst() }
- let files = scan.groups.flatMap { $0.movableFiles.dropFirst() }
+ let files = scan.groups.flatMap(\.suggestedFiles)
guard !folders.isEmpty || !files.isEmpty else {
Output.line(
scan.groups.isEmpty && scan.folderGroups.isEmpty
@@ -913,7 +922,7 @@ struct DuplicatesCommand: AsyncParsableCommand {
// decision rests on.
let kept = scan.folderGroups.compactMap { $0.folders.first?.url }.map { ["keep", Output.path($0)] }
+ scan.groups.flatMap { group in
- Self.rows(for: group.files).filter { $0[0] != "" }
+ Self.rows(for: group).filter { $0[0] != "" }
}
Output.table(kept)
let cleanup = Cleanup.of(
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index 8e5def6e..66417f36 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -393,6 +393,7 @@ extension HoldBack {
case .openedFromMail: "an attachment opened from Mail, which may be the only copy"
case .crashReport: "a crash report, which the app's developer may still ask for"
case .inTheCloud: "syncs to your other devices through iCloud or another app, so moving it would remove it from them too"
+ case .keepsWhatTheOthersLack: "has Finder tags, a comment, or a resource fork the other copies don't"
case .openInAProgram: "open in a program right now, which may still be using it"
case .attachedDiskImage: "a disk image open right now; eject it first"
case .changedRecently: "changed in the last day, so it may still be downloading"
diff --git a/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift b/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
index 91aebb1c..adb08221 100644
--- a/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
@@ -241,7 +241,7 @@ public struct DuplicateFinder: Sendable {
}
guard !Task.isCancelled else { throw CancellationError() }
- let groups = (finalGroups + Self.grouped(verified)).map(makeGroup).sorted {
+ let groups = (finalGroups + Self.grouped(verified)).compactMap(makeGroup).sorted {
($0.reclaimableSize, $0.size, $1.id) > ($1.reclaimableSize, $1.size, $0.id)
}
return DuplicateScan(
@@ -265,7 +265,6 @@ public struct DuplicateFinder: Sendable {
private struct ContentKey: Hashable {
let size: Int64
let digest: ContentDigest
- let extras: [UInt8]
}
private final class UnreadableLocations {
@@ -404,20 +403,29 @@ public struct DuplicateFinder: Sendable {
}
private static func grouped(_ hashed: [HashedCandidate]) -> [[HashedCandidate]] {
- let keyed = hashed.compactMap { candidate in
- FileExtras.of(candidate.item.url).map { extras in
- (candidate, ContentKey(size: candidate.item.identity.size, digest: candidate.digest, extras: extras))
- }
- }
- return Dictionary(grouping: keyed, by: \.1).values.filter { $0.count > 1 }.map { $0.map(\.0) }
+ Dictionary(grouping: hashed) { ContentKey(size: $0.item.identity.size, digest: $0.digest) }
+ .values.filter { $0.count > 1 }.map(Array.init)
}
- private func makeGroup(_ members: [HashedCandidate]) -> DuplicateGroup {
+ /// The group of `members`, the copy Peel suggests keeping first, or nil when fewer than two can be compared or
+ /// none could move. A copy with Finder tags, a Finder comment, or a resource fork the others lack stays: the first
+ /// with each such set, unless a copy that syncs already keeps it.
+ private func makeGroup(_ members: [HashedCandidate]) -> DuplicateGroup? {
let order = KeepOrder(home: homeDirectory)
- let files = members
- .map { ($0.item, order.rank(of: $0.item.url, identity: $0.item.identity)) }
- .sorted { $0.1 < $1.1 }
- .map { candidate, _ in
+ // A copy whose extras can't be read isn't known to be like the others.
+ var copies = members.compactMap { member in FileExtras.of(member.item.url).map { (member.item, $0) } }
+ .map { (item: $0.0, extras: $0.1, rank: order.rank(of: $0.0.url, identity: $0.0.identity)) }
+ .sorted { $0.rank < $1.rank }
+ guard copies.count > 1 else { return nil }
+ if Set(copies.map(\.extras)).count > 1 {
+ var kept = Set(copies.filter { $0.item.heldBack != nil }.map(\.extras))
+ for index in copies.indices where !copies[index].extras.isEmpty {
+ guard kept.insert(copies[index].extras).inserted else { continue }
+ copies[index].item.heldBack = .keepsWhatTheOthersLack
+ }
+ }
+ let files = copies
+ .map { candidate, _, _ in
DuplicateFile(
url: candidate.url,
size: candidate.identity.size,
@@ -427,7 +435,8 @@ public struct DuplicateFinder: Sendable {
heldBack: candidate.heldBack
)
}
- return DuplicateGroup(id: members[0].digest.hexadecimal, files: files)
+ let group = DuplicateGroup(id: members[0].digest.hexadecimal, files: files)
+ return group.movableFiles.isEmpty && !group.everyCopySyncs ? nil : group
}
/// Which copy is kept, from the home folder: its Downloads, and the disk it is on.
diff --git a/Packages/PeelCore/Sources/PeelCore/Duplicates/Duplicates.swift b/Packages/PeelCore/Sources/PeelCore/Duplicates/Duplicates.swift
index 9a760228..b8527982 100644
--- a/Packages/PeelCore/Sources/PeelCore/Duplicates/Duplicates.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Duplicates/Duplicates.swift
@@ -77,9 +77,21 @@ public struct DuplicateGroup: Sendable, Hashable, Identifiable {
files.contains { $0.heldBack == .inTheCloud }
}
- /// What moving every movable copy but the first would free.
+ /// True when a copy stays for the Finder tags, comment, or resource fork the others lack. It keeps the same bytes
+ /// on this Mac, so every copy that may move can go.
+ public var holdsACopyWithWhatOthersLack: Bool {
+ files.contains { $0.heldBack == .keepsWhatTheOthersLack }
+ }
+
+ /// The copies Peel suggests moving: every one that may move but the first, which it keeps, or every one when a
+ /// copy stays for what the others lack.
+ public var suggestedFiles: [DuplicateFile] {
+ holdsACopyWithWhatOthersLack ? movableFiles : Array(movableFiles.dropFirst())
+ }
+
+ /// What moving the suggested copies would free.
public var reclaimableSize: Int64 {
- movableFiles.dropFirst().reduce(0) { $0 + $1.reclaimableSize }
+ suggestedFiles.reduce(0) { $0 + $1.reclaimableSize }
}
}
@@ -159,9 +171,9 @@ public struct DuplicateScan: Sendable {
groups.isEmpty && folderGroups.isEmpty && !notLookedIn.isEmpty
}
- /// Every copy that may move except the first of them in each group. A copy that syncs is never suggested.
+ /// The copies each group suggests moving. A copy that stays is never suggested.
public var suggestedSelection: Set<URL> {
- Set(groups.flatMap { $0.movableFiles.dropFirst().map(\.url) })
+ Set(groups.flatMap { $0.suggestedFiles.map(\.url) })
}
public var suggestedFolderSelection: Set<URL> {
@@ -181,11 +193,11 @@ public struct DuplicateScan: Sendable {
return Set(files + folders)
}
- /// How many groups moving copies would free something in. A group of files counts only with two copies that may
- /// move, since one always stays; a folder that syncs to other devices is never offered, so every group of
- /// folders counts.
+ /// How many groups moving copies would free something in. A group of files counts only with a copy to suggest,
+ /// since one always stays; a folder that syncs to other devices is never offered, so every group of folders
+ /// counts.
public var groupsWithSomethingToMove: Int {
- groups.count { $0.movableFiles.count > 1 } + folderGroups.count
+ groups.count { !$0.suggestedFiles.isEmpty } + folderGroups.count
}
/// Returns `selection` limited to what this scan can still move: only files it lists, and never every copy of
diff --git a/Packages/PeelCore/Sources/PeelCore/Duplicates/FileExtras.swift b/Packages/PeelCore/Sources/PeelCore/Duplicates/FileExtras.swift
index 44ad03fe..d20e00c6 100644
--- a/Packages/PeelCore/Sources/PeelCore/Duplicates/FileExtras.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Duplicates/FileExtras.swift
@@ -3,7 +3,8 @@ import Darwin
import Foundation
/// What a copy carries besides its bytes, which moving it to the Trash takes away from where it was: its Finder tags,
-/// its resource fork, and its Finder comment. Copies that differ in any of them are not duplicates.
+/// its resource fork, and its Finder comment. A copy with what the others lack stays, and folders that differ in any
+/// of them inside are not copies of each other.
enum FileExtras {
/// The tags, in order, and a digest of the resource fork and of the comment, as bytes to compare. Nil when one
/// of those is there and cannot be read, since two copies are then not known to be alike.
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index 6df17cb6..f9841205 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -159,6 +159,9 @@ public enum HoldBack: String, Sendable, Hashable {
case mayBeTheOnlyCopy
/// An encrypted disk image, which holds what the person put in it.
case encryptedImage
+ /// A duplicate with Finder tags, a Finder comment, or a resource fork the other copies lack, which moving it
+ /// would lose.
+ case keepsWhatTheOthersLack
/// True when the item cannot be selected at all, rather than only left unselected: the guard or the helper
/// would refuse to move it.
@@ -169,7 +172,7 @@ public enum HoldBack: String, Sendable, Hashable {
|| self == .systemExtension || self == .systemExtensionGoingAtRestart || self == .deletableSystemExtension
|| self == .signInPlugIn
|| self == .holdsAnExclusion
- || self == .inTheCloud || self == .holdsAnotherAppsData
+ || self == .inTheCloud || self == .holdsAnotherAppsData || self == .keepsWhatTheOthersLack
}
/// Why what a walk saw leaves a folder to be chosen by hand: a wallet, a signing key, or a repository inside may
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
index 95719e1d..b75f5a07 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
@@ -189,9 +189,10 @@ struct DuplicateFinderTests {
#expect(result.groups.allSatisfy { !$0.holdsASyncedCopy })
}
- /// Moving a copy takes its Finder tags and its resource fork with it, so copies that differ in either are not
- /// duplicates, on their own or inside folders.
- @Test func copiesWithOtherTagsOrAnotherResourceForkAreNotDuplicates() async throws {
+ /// Copies with the same bytes are duplicates whatever their Finder tags or resource fork. Moving a copy takes
+ /// them with it, so a copy with what the others lack stays and the others may all go. Folders that differ in
+ /// them still aren't copies of each other, since a folder moves whole.
+ @Test func aCopyWithTagsOrAForkTheOthersLackStays() async throws {
let directory = try TemporaryDirectory()
let contract = randomData(count: 4_000)
try directory.file("home/Documents/Contract.pdf", contents: contract)
@@ -215,16 +216,34 @@ struct DuplicateFinderTests {
let result = try await scan(directory)
- #expect(Set(names(result)) == [["Documents/Contract.pdf", "Downloads/Contract.pdf"]])
+ let name = { (url: URL) in url.pathComponents.drop { $0 != "home" }.dropFirst().joined(separator: "/") }
+ #expect(Set(names(result)) == [
+ ["Documents/Contract.pdf", "Desktop/Contract.pdf", "Downloads/Contract.pdf"],
+ ["Music/sound.aiff", "Documents/sound.aiff"], ["Projects/a/notes.txt", "Projects/b/notes.txt"],
+ ])
+ let staying = result.groups.flatMap(\.files).filter { $0.heldBack == .keepsWhatTheOthersLack }.map(\.url)
+ #expect(Set(staying.map(name)) == ["Desktop/Contract.pdf", "Music/sound.aiff", "Projects/b/notes.txt"])
+ #expect(Set(result.suggestedSelection.map(name)) == [
+ "Documents/Contract.pdf", "Downloads/Contract.pdf", "Documents/sound.aiff", "Projects/a/notes.txt",
+ ])
#expect(result.folderGroups.isEmpty)
}
- /// The Finder keeps a comment in the copy's extended attributes, so it goes with the copy, as tags do.
- @Test func copiesWithAnotherFinderCommentAreNotDuplicates() async throws {
+ /// The Finder keeps a comment in the copy's extended attributes, so it goes with the copy, as tags do. Copies
+ /// that each have something the others lack all stay, so nothing could go and they aren't listed.
+ @Test func aCopyWithAFinderCommentTheOthersLackStays() async throws {
let directory = try TemporaryDirectory()
let report = randomData(count: 4_000)
try directory.file("home/Documents/Report.pdf", contents: report)
let commented = try directory.file("home/Desktop/Report.pdf", contents: report)
+ let memo = randomData(count: 4_000)
+ var blue = try directory.file("home/Documents/Memo.pdf", contents: memo)
+ var green = try directory.file("home/Downloads/Memo.pdf", contents: memo)
+ var tags = URLResourceValues()
+ tags.tagNames = ["Blue"]
+ try blue.setResourceValues(tags)
+ tags.tagNames = ["Green"]
+ try green.setResourceValues(tags)
let comment = try PropertyListSerialization.data(fromPropertyList: "Signed copy", format: .binary, options: 0)
let written = comment.withUnsafeBytes {
setxattr(
@@ -236,7 +255,9 @@ struct DuplicateFinderTests {
let result = try await scan(directory)
- #expect(result.groups.isEmpty)
+ #expect(names(result) == [["Documents/Report.pdf", "Desktop/Report.pdf"]])
+ #expect(result.groups.first?.files.last?.heldBack == .keepsWhatTheOthersLack)
+ #expect(result.suggestedSelection.map(\.lastPathComponent) == ["Report.pdf"])
}
/// Duplicates scans again only when asked, so what is excluded after a scan is taken out of it: the copy
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
index bc9e5a81..9d466cc0 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
@@ -491,7 +491,7 @@ struct FileCommandTests {
let scan = try await DuplicateFinder(homeDirectory: home).scan(.everySize(in: [home]))
let group = try #require(scan.groups.first)
- let rows = DuplicatesCommand.rows(for: group.files)
+ let rows = DuplicatesCommand.rows(for: group)
#expect(rows.count == 3)
#expect(rows.map(\.first) == ["keep", "", ""])
@@ -514,7 +514,7 @@ struct FileCommandTests {
let group = try #require(scan.groups.first)
let synced = try #require(group.files.first { $0.heldBack == .inTheCloud })
- let rows = DuplicatesCommand.rows(for: group.files)
+ let rows = DuplicatesCommand.rows(for: group)
#expect(rows.first { $0[1] == Output.path(synced.url) }?[0] == "stays")
#expect(rows.map { $0[0] }.sorted() == ["", "keep", "stays"])
@@ -531,6 +531,35 @@ struct FileCommandTests {
#expect(FileManager.default.fileExists(atPath: synced.url.path(percentEncoded: false)))
}
+
+ /// A copy with tags the others lack stays and keeps the bytes for them, so no copy is marked "keep" and every
+ /// other one moves; the JSON names it under stays.
+ @Test func movesEveryOtherCopyWhenOneStaysForWhatTheOthersLack() async throws {
+ let directory = try TemporaryDirectory()
+ let logs = logs(in: directory)
+ let contents = Data((0..<4_000).map { _ in UInt8.random(in: 0...255) })
+ var tagged = try directory.file("home/Documents/a.bin", contents: contents)
+ try directory.file("home/Pictures/a.bin", contents: contents)
+ var red = URLResourceValues()
+ red.tagNames = ["Red"]
+ try tagged.setResourceValues(red)
+ let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
+ let scan = try await DuplicateFinder(homeDirectory: home).scan(.everySize(in: [home]))
+ let group = try #require(scan.groups.first)
+
+ #expect(DuplicatesCommand.rows(for: group).map { $0[0] }.sorted() == ["", "stays"])
+ let json = try Output.jsonText(DuplicatesCommand.found(in: scan))
+ let found = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any])
+ let record = try #require((found["files"] as? [[String: Any]])?.first)
+ #expect(record["stays"] as? [String] == [Output.path(tagged)])
+ #expect(record["synced"] as? [String] == [])
+
+ try await (command(["duplicates", "--remove", "-y"]) as DuplicatesCommand)
+ .clean(scan, using: try service(in: directory), recordingIn: logs.removals, refusals: logs.refusals)
+
+ #expect(await moved(logs) == ["a.bin"])
+ #expect(FileManager.default.fileExists(atPath: tagged.path(percentEncoded: false)))
+ }
@Test func saysHowManyCopiesOfAFolderAndHowBigItIs() async throws {
let directory = try TemporaryDirectory()
let contents = Data((0..<4_000).map { _ in UInt8.random(in: 0...255) })
diff --git a/Peel/Views/Duplicates/DuplicateGroupView.swift b/Peel/Views/Duplicates/DuplicateGroupView.swift
index a74e1035..75f67bba 100644
--- a/Peel/Views/Duplicates/DuplicateGroupView.swift
+++ b/Peel/Views/Duplicates/DuplicateGroupView.swift
@@ -46,8 +46,12 @@ struct DuplicateGroupView: View {
private var copiesNote: LocalizedStringResource {
if group.everyCopySyncs {
"These copies sync to your other devices, so Peel lists them and never moves one: the Trash would take it from every device."
+ } else if group.holdsASyncedCopy, group.holdsACopyWithWhatOthersLack {
+ "Selected copies go to the Trash. A copy marked Stays syncs to your other devices, or has Finder tags, a Finder comment, or a resource fork the others don’t, and is never moved."
} else if group.holdsASyncedCopy {
"Selected copies go to the Trash. Peel always keeps at least one. A copy marked Stays syncs to your other devices and is never moved."
+ } else if group.holdsACopyWithWhatOthersLack {
+ "Selected copies go to the Trash. A copy marked Stays has Finder tags, a Finder comment, or a resource fork the others don’t, and is never moved."
} else {
"Selected copies go to the Trash. Peel always keeps at least one."
}
@@ -125,11 +129,11 @@ private struct DuplicateFileRow: View {
HStack(alignment: .firstTextBaseline, spacing: 10) {
if let heldBack = file.heldBack {
// No checkbox: the copy can never be selected, and a disabled one would dim the very words the
- // person reads here, where the copy is. The cloud stands where the other rows' checkbox stands, 16
- // points wide and 5 before the item, so the copies of a group line up.
+ // person reads here, where the copy is. The cloud, or the tag, stands where the other rows' checkbox
+ // stands, 16 points wide and 5 before the item, so the copies of a group line up.
HStack(alignment: .firstTextBaseline, spacing: 5) {
- Image(systemName: "icloud")
- .foregroundStyle(.blue)
+ Image(systemName: heldBack == .inTheCloud ? "icloud" : "tag")
+ .foregroundStyle(heldBack == .inTheCloud ? AnyShapeStyle(.blue) : AnyShapeStyle(.secondary))
.frame(width: 16, height: 16)
.alignmentGuide(.firstTextBaseline) { $0[.bottom] - 3 }
.accessibilityHidden(true)
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index c3c2396c..2ddc5a55 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -406,6 +406,8 @@ extension HoldBack {
"Not selected: a report macOS wrote when the app crashed, which its developer may still ask you for."
case .inTheCloud:
"Left alone: this syncs to your other devices through iCloud or another app, and moving it to the Trash would also remove it from them."
+ case .keepsWhatTheOthersLack:
+ "Left alone: this copy has Finder tags, a Finder comment, or a resource fork the others don’t, which moving it would lose."
case .openInAProgram:
"Not selected: a program has this open right now, and may still be using it."
case .attachedDiskImage:
diff --git a/SAFETY.md b/SAFETY.md
index 1b7390f8..0133dbf1 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -478,14 +478,15 @@ still shows its reason beside it.
In Duplicates, one copy of every group always stays, and a file that changed since the scan is refused. When a scan you
started ends, Duplicates selects every copy but the first of each group, the one it suggests keeping: check which copy
stays before you move the others. Nothing inside a repository, a project, `node_modules`, a photo or music library, an
-app, or another package is ever offered, nor a hidden file or folder, such as a tool's settings in `~/.config`. An
-app, another package, or anything hidden counts only toward the folder around it, a document its app keeps as a
-package among them, such as a Logic Pro or Scrivener project, even once the app is gone, while a folder holding a
-repository, a project, `node_modules`, or a library is never compared, nor any folder above it. Copies that differ in
-their Finder tags, their Finder comment, or their resource fork aren't listed together, since moving the copy that has
-them would take that away, and a folder kept only in the cloud is never looked into. A copy in a folder that syncs to
-your other devices, iCloud Drive or one a sync app keeps in step, is listed and never selected or moved: its row reads
-Stays, and a group whose every copy syncs is listed under Synced to Other Devices.
+app, or another package is ever offered, nor a hidden file or folder, such as a tool's settings in `~/.config`. An app,
+another package, or anything hidden counts only toward the folder around it, a document its app keeps as a package among
+them, such as a Logic Pro or Scrivener project, even once the app is gone, while a folder holding a repository, a
+project, `node_modules`, or a library is never compared, nor any folder above it. A copy with Finder tags, a Finder
+comment, or a resource fork the others lack is listed and never selected or moved, since moving it would take that away;
+it keeps the bytes for the others, which can all go. Folders that differ in them inside aren't listed together, and a
+folder kept only in the cloud is never looked into. A copy in a folder that syncs to your other devices, iCloud Drive or
+one a sync app keeps in step, is listed and never selected or moved: its row reads Stays, and a group whose every copy
+syncs is listed under Synced to Other Devices.
What you select on the pages that free space (Orphaned Files, Space, Developer, Build Artifacts, Installers and Backups,
Duplicates, and File Search) stays selected while you look at the others, and Move to Trash on any of them moves all of