Re: How to detect Time Machine volume?
Re: How to detect Time Machine volume?
- Subject: Re: How to detect Time Machine volume?
- From: Charles Srstka <email@hidden>
- Date: Tue, 02 Aug 2011 13:51:25 -0500
On Aug 2, 2011, at 12:37 PM, Stephane Sudre wrote:
> Worse case: an old time machine partition has been replaced by a new
> one. Since the old partition is some kind of a second backup, the user
> has not removed the Time Machine files.
Depending on what he wants to do, this may not be a relevant distinction. I’ve got a case where I’m doing something similar, running a catalog search for most volumes, but not for Time Machine volumes or for FAT-format disks. The reason I don’t catalog search a TM volume is because it takes forever to do, and because the results from inside a backup are not interesting for this particular operation. This remains true even if the Backups.backupdb directory is no longer the active backup directory — even if it isn’t, it will still take too long for me to search, and the results inside it will not be interesting. The reason I don’t catalog search a FAT-format disk is because FSCatalogSearch doesn’t support it (which, I’m guessing, is the reason he wants to exclude Boot Camp volumes). Here’s what I do:
1. Do a FSGetVolumeParms on the volume and check for bSupportsFSCatalogSearch
2. If it does, check for Backups.backupdb at the root of the drive.
3. If the drive supports FSCatalogSearch and there’s no backupdb, do a catalog search.
4. Otherwise, do a regular recursive search of the file system hierarchy, and skip over Backups.backupdb if I encounter it.
Worst-case scenario: An HFS+ disk with lots of files on it takes longer to scan than it needed to because there turned out to be a file called Backups.backupdb at the root.
Typical scenario: Encountering a Time Machine drive causes a nice and quick recursive search through not many files, since most users don’t store too many extra files on their Time Machine backup drive.
In either case, you *will* find the file you need, regardless of whether or not there happens to be a Backups.backupdb there.
Charles_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden