Text im Dateinamen ersetzen

11/03/2009
A-Better-Finder-Renamer und andere Tools machen das u.a. auch. Diese Skript ist aber recht klein und tut als Droplet bzw. als Skript im Skript-Menü genau das, was man immer mal wieder kurz machen möchte.... einfach ein bischen Search&Replace in Dateinamen:
Code zum markieren einmal anklicken

on open these_items

tell application "Finder"

display dialog "Replace:" default answer ""

set searchstring to text returned of the result

display dialog "with:" default answer ""

set replacestring to text returned of the result

repeat with this_item in these_items

set itemname to name of this_item

set AppleScript's text item delimiters to searchstring

set the item_list to every text item of itemname

set AppleScript's text item delimiters to replacestring

set this_text to the item_list as string

set AppleScript's text item delimiters to ""

set name of this_item to this_text as text

end repeat

end tell

end open

on run

tell application "Finder"

set these_items to selection

display dialog "Replace:" default answer ""

set searchstring to text returned of the result

display dialog "with:" default answer ""

set replacestring to text returned of the result

set these_items to selection

repeat with this_item in these_items

set itemname to name of this_item

set AppleScript's text item delimiters to searchstring

set the item_list to every text item of itemname

set AppleScript's text item delimiters to replacestring

set this_text to the item_list as string

set AppleScript's text item delimiters to ""

set name of this_item to this_text as text

end repeat

end tell

end run

No Comments