Rename files with filename longer than

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Rename files with filename longer than 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!!
m3ki
 
Posts: 3
Joined: Mon Jul 21, 2014 5:27 pm

Re: Rename files with filename longer than 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.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename files with filename longer than 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.
m3ki
 
Posts: 3
Joined: Mon Jul 21, 2014 5:27 pm

Re: Rename files with filename longer than 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.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename files with filename longer than 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
m3ki
 
Posts: 3
Joined: Mon Jul 21, 2014 5:27 pm


Return to Support