how can I shorted attachment names in messages of Mail


I’ve got a routine that saves mail & attachments as rtfd docs.

Unfortunately they have to be saved on a windows server, and long attachment names are proving to be a problem (interestingly, the server sees rtfd’s as a folder)

Does anyone know a way to reset the names of mail attachments please.



tell application "Mail"
	set temp to every message of mailbox "tester"
	repeat with A in temp
		open A
		--set AA to name of attachment 1 of document 1
		repeat with AA in the mail attachments of A
			set n to name of AA
			set newname to n
			if (count of n) > 30 then
				set TheSuffix to ""
					set TheSuffix to the name extension of n
				end try
				if (count of TheSuffix) > 0 then set TheSuffix to "." & TheSuffix
				set newname to (characters 1 thru (30 - (count of TheSuffix)) of n) & TheSuffix
			end if
			set the name of AA to newname -- this doesn't work
		end repeat
	end repeat
end tell

That’s because they are! However, Mac OS X treats them as a package (try right-clicking on one and choosing “Show Package Contents”).

G’day Bruce

I wish they were a package, or I could rename the files directly.

Right clicking does nothing in terms of showing a package, and opening with BBedit shows just a continuous list of data.

I’ve tried altering the rtfd attachments as well, but you can’t even read the attachments names in TextEdit.