Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

One Liner to Loop Through a Directory for Last Used Date of Apps on a Mac

Here we load in a list of Apps in the /Applications directory and then echo them along with the kMDItemLastUsedDate from Spotlight via mdls:

ls /Applications | while read APP;do echo "$APP" ; echo `/usr/bin/mdls /Applications/"$APP" |  /usr/bin/grep -w kMDItemLastUsedDate`; done

The output per item would then look something like this:

Apple Configurator.app
kMDItemLastUsedDate = 2022-09-27 18:25:21 +0000

awk can get the $3 if that’s all that’s needed or other filtering tools can limit the output. Or get more output, like a bundle ID (kMDItemCFBundleIdentifier) or an Apple Store ID (kMDItemAppStoreAdamID) for parsing through other tools. Further no need to echo the string of the name of the app according to how the data is being used, so that first echo could easily be removed.

Note: There are items in /Applications that aren’t called directly (e.g. filters for other apps). Not all apps have been opened either. Therefore, not all entries would have a last used date.

The post One Liner to Loop Through a Directory for Last Used Date of Apps on a Mac appeared first on krypted.



This post first appeared on Krypted.com | Tiny Deathstars Of Foulness, please read the originial post: here

Share the post

One Liner to Loop Through a Directory for Last Used Date of Apps on a Mac

×

Subscribe to Krypted.com | Tiny Deathstars Of Foulness

Get updates delivered right to your inbox!

Thank you for your subscription

×