identify files with names >31 characters?

Hi, all-

I’ve looked around a bit, but maybe someone’s got a solution for this:

I need a script that can take the contents of a folder and set a label color on any file that has more than 31 characters (including the filename extension). I’m not geeky enough to write it myself… :frowning:

(we’re running OS X 10.3.X).

Thanks in advance for any help this forum can provide.

Eric

Browser: Safari 125.12
Operating System: Mac OS X (10.3.8)

hi,

Try this code,

set source_folder to choose folder
tell application "Finder"
	set file_list to every file of source_folder
	repeat with a_file in file_list
		if (count of characters of (name of a_file as string)) is greater than 31 then set label index of a_file to 2
	end repeat
end tell

Aw, freakin’ SWEET!

Thanks so much! I learn more and more every time I post here!

Let there be the finest meats and cheeses for the contributors to this forum!

Seriously, thanks. Quite an elegant solution!

Best,

Eric

Great find! Just what I was looking for. Thanks!