Page 1 of 1

Rename files with filename longer than

PostPosted: Mon Jul 21, 2014 5:31 pm
by m3ki
Hi I am using hazel and recently ran into trouble on how to implement something...

I am running issue with filenames longer than 143 characters on my nas and would like hazel to do the following.
Match: Locate files longer than 143 characters
Do: rename file/truncate filename to 143 or at least highlight the file with different color.

Is this at all possible?
Any help is greatly appreciated!!

Re: Rename files with filename longer than

PostPosted: Tue Jul 22, 2014 10:52 am
by Mr_Noodle
You'll probably need to write a script to do this. You'd need a script to do the match and then another script to perform the action.

Re: Rename files with filename longer than

PostPosted: Tue Jul 22, 2014 11:20 am
by m3ki
Would anybody be able to help me with the matching script by any chance?
I am a complete noob when it comes to apple script or shell scripts.

Re: Rename files with filename longer than

PostPosted: Wed Jul 23, 2014 3:07 pm
by Mr_Noodle
If you don't get a response here, I suggest checking out some AppleScript forums and see if anyone there can help you.

Re: Rename files with filename longer than

PostPosted: Fri Jul 25, 2014 12:01 pm
by m3ki
I think I got it in the end after long browsing...

Code: Select all
tell application "Finder" to set theName to name of theFile

if length of theName > 140 then
   return true
else
   return false
end if