3 ms·
Mac users using iCloud, be careful about attempting to "stat" the entire filesystem, this will cause iCloud Drive to download its entire contents onto your loca
by LeoPanthera 2y ago
Mac users using iCloud, be careful about attempting to "stat" the entire filesystem, this will cause iCloud Drive to download its entire contents onto your local disk.
- madaxe_again 2y agoYou just discovered this the hard way, didn’t you?
- LeoPanthera 2y agoNot today! But in the past... yes.
- dfox 2y agoSame thing will happen on macOS with SharePoint/OneDrive. Found that out the hard way last week.
- actionfromafar 2y agoNever cross the streams.
- Someone 2y agoNot anymore, does it? https://eclecticlight.co/2023/10/25/macos-sonoma-has-changed-icloud-drive-radically/ https://eclecticlight.co/2023/10/25/macos-sonoma-has-changed...: “I suspect these new evicted files take advantage of a trick in APFS: as far as I can tell, they consist of the file with its attributes and extended attributes intact and stored locally, but no extents for its data. Thus, when you ask for the file size, it returns the size it would be when downloaded, although the file only takes the space required for its attributes and extended attributes, until it has been downloaded.” Also (https://developer.apple.com/documentation/technotes/tn3150-getting-ready-for-data-less-files https://developer.apple.com/documentation/technotes/tn3150-g...): “Check if a file is dataless and then only access it in a safe context. To do the check, call stat or getattrlist and examine if SF_DATALESS is present in stat.st_flags. Be aware that stat and getattrlist both trigger the materialization of any intermediate folders in the file’s path, if they themselves are dataless.” ⇒ doing stat on an entire filesystem will materialize all directories, but not its files.