I’m trying to modify the ‘Replace Text In Item Names’ sample script to work in subfolders. I have read a couple of other posts on using the recursive function, however I’ve no idea what I’m doing. So I hope somebody has a fast, easy answer on how to modify this.
set the item_list to list folder source_folder without invisibles set source_folder to source_folder as string repeat with i from 1 to number of items in the item_list set this_item to item i of the item_list set this_item to (source_folder & this_item) as alias set this_info to info for this_item set the current_name to the name of this_info set change_flag to false if the current_name contains the search_string then if the search_parameter is "Folder Names" and ¬ folder of this_info is true then set the change_flag to true else if the search_parameter is "File Names" and ¬ folder of this_info is false then set the change_flag to true else if the search_parameter is "Both" then set the change_flag to true end if if the change_flag is true then -- replace target string using delimiters set AppleScript's text item delimiters to the search_string set the text_item_list to every text item of the current_name set AppleScript's text item delimiters to the replacement_string set the new_item_name to the text_item_list as string set AppleScript's text item delimiters to "" my set_item_name(this_item, new_item_name) end if end if end repeat
I found a OS 9 script that does what I want, but it doesn’ t work in OS X. I tried changing the OS X script by editing the line:
set the item_list to list folder source_folder without invisibles
set the item_list to every item of the source_folder
set the item_list to entire contents of the source_folder
and numerous variations of those lines, but they return errors that they “can’t get every item.” I take it these methods no longer work in OS X?
In reading the previous posts, I’m just not sure how to apply them to my script, as what I tried didn’t work.
FYI, the script I’m attempting to modify is available in the sample Finder scripts installed w/ OS X.
Any and all help is appreciated.