I must have done something wrong but I don’t understand what.
Trying to get some infos about files stored in a disk used for Time Machine, I tried to apply a piece of ASObjC code which I use daily.
As it returned “the folder is empty”, I added some instructions grabbing the entire contents of the scanned folder.
As you may see below, the Finder returned a list of 40 aliases.
What may explain this seemingly odd behavior ?
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
set sourcePath to "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Images:"
tell application "Finder"
set entireContents to get entire contents of folder sourcePath as alias list
--> {alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:2017-02-24 Envinet.pdf", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:2019-10-27 ebay.pdf", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Aperture Library.aplibrary:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Aperture Library.migratedaplibrary:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Bibliothèque Photo Booth:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Capture One Catalog.cocatalog:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Captures:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:ImageWell:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Photos Library.photoslibrary:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Snapshots:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:Wondershare UniConverter:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:à moitié.pdf", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:com.iwebvisitor.iscreenior:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:ecsb_background_tile.png", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:numérisées:", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:1 - Microcontrast Auto.cr2", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:1 - Microcontrast Auto.cr2.dop", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:2 - ClearView.jpg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:3 - PRIME.nef", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:4 - Smart Lighting SpotWAuto.rw2", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:DxO OpticsPro 11 Samples:5 - Smart Lighting Uniform.cr2", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_1.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_10.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_11.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_12.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_13.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_14.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_15.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_16.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_2.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_3.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_4.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_5.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_6.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_7.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_8.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:mojave_dynamic:mojave_dynamic_9.jpeg", alias "Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Pictures:numérisées:DSC_0164.jpg"}
end tell
log (count entireContents) --> (*40*)
--set sourcePath to "clone Macintosh HD:Macintosh …2.0:" -- used to check that the script is OK
set sourceURL to current application's NSURL's fileURLWithPath:(POSIX path of sourcePath)
-- Define several constants
set fileManager to a reference to current application's NSFileManager's defaultManager()
set skipsHiddenFiles to current application's NSDirectoryEnumerationSkipsHiddenFiles as integer --> 4
set theOptions to skipsHiddenFiles
set NSURLIsDirectoryKey to current application's NSURLIsDirectoryKey
set NSURLIsPackageKey to current application's NSURLIsPackageKey
set keysToRequest to {NSURLIsDirectoryKey, NSURLIsPackageKey}
-- Grab the content of the folder containing the backup files
--set theURLs to (fileManager's enumeratorAtURL:(sourceURL) includingPropertiesForKeys:keysToRequest options:theOptions errorHandler:(missing value))'s allObjects()
set theURLs to (fileManager's enumeratorAtURL:sourceURL includingPropertiesForKeys:keysToRequest options:0 errorHandler:(missing value))'s allObjects()
if (count theURLs) = 0 then error "Le dossier “" & sourcePath & "” est vide."
--> "Le dossier “Seagate 3To:Backups.backupdb:iMac de Yvan:2019-11-22-134006:SSD 1000:Users:**********:Images:” est vide." number -2700
theURLs as list
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 5 juillet 2020 17:39:27