Delete Older Version

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Delete Older Version Sun Jun 02, 2013 3:01 pm • by happyuser
Happy User Here,

I can’t figure out how to have Hazel go through a folder of apps, some with multiple versions, and delete (only) the older versions. Any ideas?

Thanks.
happyuser
 
Posts: 3
Joined: Sun Jun 02, 2013 2:56 pm

Re: Delete Older Version Sun Jun 02, 2013 4:27 pm • by sjk
It depends on how you'll identify which versions are considered older than others. For example, do the filenames provide enough version information or would it have to be determined some other way?

And would you only want Hazel to do this when explicitly running rules or would it be ongoing (permanently enabled/active)? If the latter, why/how would older versions still be saved there in the future if only to be deleted?

Do you have so many older app versions to delete that it's impractical to do once manually then only save current versions there in the future? :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Delete Older Version Sun Jun 02, 2013 8:36 pm • by happyuser
Thanks for your reply. I don’t have this as a problem with my Apps folder. (That would be bad.) Maybe I don’t need to do this—you are welcome to suggest so—but on a partition on my external drive I keep backups of iOS apps I’ve purchased. These have the same app name, but different version number, so yes, the filename reveals the difference. On my everyday hard drive, these apps get updated through iTunes, which trashes previous versions, but if I copy these over to my backup partition, I then have to manually go through the backup folder and delete the earlier versions.

Ideally, when I plug in my external drive, Hazel would transfer the different/newer iOS apps to the external drive and then delete from the external drive the earlier versions.


sjk wrote:It depends on how you'll identify which versions are considered older than others. For example, do the filenames provide enough version information or would it have to be determined some other way?

And would you only want Hazel to do this when explicitly running rules or would it be ongoing (permanently enabled/active)? If the latter, why/how would older versions still be saved there in the future if only to be deleted?

Do you have so many older app versions to delete that it's impractical to do once manually then only save current versions there in the future? :)
happyuser
 
Posts: 3
Joined: Sun Jun 02, 2013 2:56 pm

Re: Delete Older Version Sun Jun 02, 2013 11:54 pm • by sjk
happyuser wrote:but on a partition on my external drive I keep backups of iOS apps I’ve purchased. These have the same app name, but different version number, so yes, the filename reveals the difference.

Not necessarily; here's an obvious exception:

Code: Select all
% ls -1 Angry*
Angry Birds 1.0.2.ipa
Angry Birds 1.1.3 1.ipa
Angry Birds 1.1.3.ipa
Angry Birds 1.2.0 1.ipa
Angry Birds 1.2.0.ipa
Angry Birds 1.3.0 1.ipa
Angry Birds 1.3.0 2.ipa
Angry Birds 1.3.0.ipa
Angry Birds 1.4.0 1.ipa
Angry Birds 1.4.0.ipa
Angry Birds 1.5.1 1.ipa
Angry Birds 1.5.1.ipa
Angry Birds 1.5.2.ipa
Angry Birds 1.6.2 1.ipa
Angry Birds 1.6.2.ipa
Angry Birds 3.1.2 1.ipa
Angry Birds 3.1.2.ipa
Angry Birds 3.3.0.ipa

:shock:

That's a mix of unique iPhone/iPod and iPad versions of free editions I've accumulated. As you see, there's no way to identify and differentiate them just from filenames. Of course you might not currently have apps named like those but it's good to know they could exist in the future.

Thanks for the detailed explanation of what you'd like to do. Seems impossible without scripting, if you want to handle cases like above. I don't know much about the contents of ZIP-formatted IPA files but iTunesMetadata.plist files I just extracted from a couple appear to contain enough information for accurate name/version identification purposes, e.g.:

Code: Select all
% egrep -A1 'bundleVersion|itemName' *.plist
iTunesMetadata copy.plist:   <key>bundleVersion</key>
iTunesMetadata copy.plist-   <string>1.1.3</string>
--
iTunesMetadata copy.plist:   <key>itemName</key>
iTunesMetadata copy.plist-   <string>Angry Birds Star Wars HD Free</string>
--
iTunesMetadata.plist:   <key>bundleVersion</key>
iTunesMetadata.plist-   <string>1.1.3</string>
--
iTunesMetadata.plist:   <key>itemName</key>
iTunesMetadata.plist-   <string>Angry Birds Star Wars Free</string>

Hopefully that much is helpful. I can't go any further with it now.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Delete Older Version Mon Jun 03, 2013 10:02 pm • by happyuser
Thanks for taking the time to answer. Wish it were easier for Hazel to do, but I now understand more of the complexities involved.
happyuser
 
Posts: 3
Joined: Sun Jun 02, 2013 2:56 pm


Return to Support

cron