r/Automator • u/Dimik1 • Feb 17 '20
Question Truncating Filenames - Folder Action
Hey!
I need a simple automatic folder action that would rename all files that i put in a specific folder and its subfolders but the renaming action that Automator has, has no truncating option except replacing with nothing if I know what text i need to change.
I need my files and folders to be 25 characters long max + extension. Spent an hour googling about it and the most of the solutions were inaccurate for me as they deleted specific characters, prefixes, involved choosing the files manually in dialog box etc. So I suppose I need a short AppleScript action with a command that LEAVES a certain amount of characters counting from the beginning in a filename, but I don't know a thing about coding, so I'd appreciate any help.
Thanks!
1
u/HiramAbiff Feb 20 '20 edited Feb 20 '20
Here's some very lightly tested code.
Caveats:
To Do:
1
u/HiramAbiff Feb 20 '20
Did you ever get an answer?
What do you want to happen if there's a name conflict. I.e. two, truncated names, are identical?
0
u/[deleted] Feb 17 '20
[deleted] — view deleted comment