osx - How to query recent items in mac os x? -
i understand, in mac os x, system-wide os keeps tracks of list of recent opened items (files) (click apple icon, , click "recent items". obtain list can used other purposes. possible have api query such items or has been stored in file locally (if so, location)?
thanks
it's stored in:
/users/username/library/preferences/com.apple.recentitems.plist
it's binary property list file, can view contents in xcode, or use /usr/libexec/plistbuddy in terminal, or use property list api's.
here's bash script dump recent documents in alpha order.
doccount=$(/usr/libexec/plistbuddy -c "print recentdocuments:maxamount" \ ~/library/preferences/com.apple.recentitems.plist) (( i=0; i<doccount; i++ )); /usr/libexec/plistbuddy -c "print recentdocuments:customlistitems:$i:name" \ ~/library/preferences/com.apple.recentitems.plist done | sort
Comments
Post a Comment