Mac OS 9: Temporary Items Not Moved to Trash

This article discusses an issue where Mac OS 9.0.x does not move items from the Temporary Items folder to the Trash if the computer stops responding or "freezes".
Symptom

The amount of available space on your computer's hard disk seems to be dramatically decreasing even though you're not saving any large files on it. This symptom seems to occur especially after the computer stops responding or "freezes" when you are using a graphics application like Photoshop.



Solution

Install Mac OS 9.1. An update to Mac OS 9.1 is available from Apple Software Updates (http://www.apple.com/swupdates/).

In Mac OS 9, there is an invisible folder named Temporary Items that applications can use to store temporary files. For example, a graphics application can save changes to an image as temporary files so that the user can undo, or revert back to previous changes. Normally, these temporary files are deleted when the user quits the application.

If, however, the pointer "freezes" or the computer does not respond, the Finder moves any files in the Temporary Items folder to a Rescued Items folder in the Trash when the computer restarts. You can look in this folder for any items you wish to recover, or you can empty the Trash to recover the disk space.

With Mac OS 9.0.x, the Finder does not move files from the Temporary Items folder to the Trash. This can result in a noticeable loss of available space depending on how large the files are. This situation has been corrected in Mac OS 9.1.

If you don't update to Mac OS 9.1 you can use the AppleScript below as a startup item. Follow these steps to make the AppleScript applet:

This creates a small startup applet that works only with the versions of Mac OS 9.0.x that have this condition. It emulates the Finder's expected behavior by creating a folder called Rescued Items in the Trash that will contain any items found in the Temporary Items invisible folder. You can look in this folder for any items you wish to recover, or you can empty the Trash to recover the disk space.

--Begin AppleScript
tell application "Finder" to get the version
set FinderVersion to the result as text
if FinderVersion is less than "9.0" then
display dialog "This AppleScript requires Mac OS 9 or later."¬

 with icon stop buttons "OK" default button 1
return
end if

if FinderVersion is less than "9.1" then -- version with problem
tell application "Finder" to set BootVol to name of startup disk
set TmpItems to BootVol & ":Temporary Items:" as text

try
 set FolderContents to list folder TmpItems without invisibles
 if (count of FolderContents) is 0 then return
on error
 return -- probably no folder exists
end try

--Are there Rescued Items folders in the Trash already?
tell application "Finder" to get every item of trash ¬
 whose name begins with "Rescued Items"
set RescuedCnt to count of the result
if RescuedCnt is 0 then
 set RescuedItemName to "Rescued Items"
else
 set RescuedCnt to RescuedCnt + 1
 set RescuedItemName to "Rescued Items " & RescuedCnt as text
end if

tell application "Finder"
 --Finder cannot create new folders in the trash, so make one

 --on the desktop...
 make new folder at desktop with properties {name:RescuedItemName}
 -- and then move it to the trash
 move folder RescuedItemName of desktop to trash
end tell
--construct the rescue target path
set RescuedItemsPath to BootVol & ":Trash:" & RescuedItemName & ":" ¬

   as text

repeat with FolderItem in FolderContents
 set ItemPath to TmpItems & FolderItem as text
 set ItemInfo to info for alias ItemPath
 set ItemIsFolder to folder of ItemInfo
 if ItemIsFolder then -- It's a folder
  set ItemCanBeMoved to true
 else -- It's a file
  --busy check requires Mac OS 9 Standard Additions
  set ItemCanBeMoved to not busy status of ItemInfo
 end if
 if ItemCanBeMoved then
  try
   
tell application "Finder" to move alias ItemPath to ¬
   
alias RescuedItemsPath
  on error
   --something unexpected happened, keep going
  end try
 end if
end repeat
else
-- probably fixed after this release
end if
--End AppleScript


Note: A compiled version of this AppleScript is available at:

ftp://ftp.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/Misc/AppleScript/Remove_Temp_Items.bin

Published Date: Feb 20, 2012