Script to Toggle Burn Folders in Tiger

This script, which appeared in MacOSXhints (author = Koncept) will toggle a selected normal Finder folder to a burn folder ready for backup and then applying the script again to the burn folder, will toggle it back to a normal folder.


tell application "Finder"
	set userSelection to selection
	repeat with thisItem in userSelection
		if class of thisItem is not folder then set userSelection to rest of userSelection
	end repeat
	if userSelection is not {} then my toggleState(userSelection)
end tell

on toggleState(aList)
	tell application "Finder"
		repeat with aFld in aList
			if name extension of aFld is not "fpbf" then -- normal folder
				set src to items 1 thru -2 of (text items of (POSIX path of (aFld as string))) as string
				set newSrc to src & ".fpbf"
			else if name extension of aFld is "fpbf" then -- revert
				set src to items 1 thru -2 of (text items of (POSIX path of (aFld as string))) as string
				set newSrc to items 1 thru -6 of src as string
			end if
			try
				do shell script "/bin/mv" & space & quoted form of (src) & space & quoted form of (newSrc)
			end try
		end repeat
	end tell
end toggleState