Renaming files and folder
Renaming files and folder
- Subject: Renaming files and folder
- From: Gudrun Claeys <email@hidden>
- Date: Sat, 11 Dec 2004 07:39:42 +0000
Title: Renaming files and folder
Hi all,
The problem with renaming files and folders is the the renaming only takes place on the top level folder and the level below, any folder below this isn’t renamed. I can’t seem to find a way of drilling through the whole folder structure. Please can anyone help me.
try
tell application "Finder"
activate
set the item_list to ((every item of the source_folder whose name contains the search_string) & (source_folder)) as list
repeat with this_item in the item_list
set the item_name to the name of this_item
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of the item_name
set AppleScript's text item delimiters to the replacement_string
set the new_item_name to the item_list as string
set AppleScript's text item delimiters to ""
try
set the name of this_item to the new_item_name
on error error_msg
set the source_folder_path to my extract_parent_folder_path_from(this_item)
try
reveal (the source_folder_path & the new_item_name) as string as alias
on error
reveal this_item
set error_msg to "The new name: " & return & the new_item_name & return & "contains too many characters to rename this file."
end try
beep
display dialog error_msg buttons {"Stop", "Continue"} default button 2
if the button returned of the result is "Stop" then return "user canceled"
set selection to {}
end try
end repeat
beep 2
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden