Add character to filename when folder is opened


I have been asked to to the following: every time a specific folder is opened, a character must be added to all the files in it. The purpose of this is the control of printed files. When the folder is opened, a character is added to all the files (ex. P_) and the other persons know that this folder items has been processed for print.

All we need is a label “printed”.

Can you think of something else?

The operating system is 10.5

Thanks in advance!


Do you mean something like this?

on run
	display dialog "Are all files printed?" buttons {"No", "Yes"} default button 2 cancel button 1
	tell application "Finder"
		set folderToProcess to container of (path to me) as alias
		set itemsToProcess to every item of folderToProcess whose name does not end with " °APD°" -- which stands for All Ready Printed
		repeat with i in itemsToProcess
			set orName to (name of i) as string
			-- choping of extension
			if name extension of i is not "" then if orName ends with (name extension of i) then set orName to ((characters 1 thru ((count every character of orName) - ((count every character of (name extension of i as string)) + 1))) of orName) as string
			set newName to (orName & " °APD°") as string
			if name extension of i is not "" then set newName to (newName & "." & name extension of i) as string
			set name of i to newName
		end repeat
	end tell
	-- display dialog "Done" buttons "¢" default button 1 giving up after 3
end run

Hope it helps,


the easiest solution is a folder action, which changes the color of the label

on opening folder thisFolder
	tell application "Finder" to set label index of items of thisFolder to 4
end opening folder


Here’s a very sloppy one-liner to show how trivial it can be (prefixing is always waay easier than suffixing, BTW) but. You need to define your workflow better. Just opening a folder doesn’t mean anything is printed. You need to determine if a file has been printed before you start flagging them. What if I open the folder but then have to go to the bathroom? I close the folder and, while I’m indisposed, someone comes along and says “Hey, all these files are printed. Sweet!”

tell application "Finder" to set name of (selection as alias) to (("P_" & (name of (selection as alias))) as Unicode text)

Jim Neumann