Monday, November 08, 2010 at 12:01 AM.

system.verbs.apps.FinderMenu.commands.backup.makeSpace

on makeSpace () {
	local (backupFolder = FinderMenu.commands.backup.path);
	if backupFolder == "" {
		scriptError ("Use the Set Backup Path command to set your backup folder.")};
	
	on volFreeSpace () {
		return (file.freeSpaceOnVolume (file.volumeFromPath (backupFolder)))};
	local (outerFolder, innerFolder, keeper, x);
	local (oldSpace = volFreeSpace ());
	fileloop (outerFolder in backupFolder) {
		keeper = FinderMenu.commands.backup.mostRecentBackup (outerFolder);
		fileloop (innerFolder in outerFolder) {
			x = FinderMenu.commands.backup.getBackupNumber (innerFolder);
			if x != keeper { <<it's the one we're keeping
				file.deleteFolder (innerFolder)}}};
				<<msg (string.kBytes (volFreeSpace () - oldSpace) + " reclaimed.")
	};
	<<bundle
		<<speaker.beep ()
		<<Frontier.bringToFront ()
		<<dialog.notify (string.kBytes (volFreeSpace ()) + " free on " + file.volumeFromPath (backupFolder))
		<<Finder.bringToFront ()
makeSpace ()



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.