Re: Setting filename of files and in subfolders
Re: Setting filename of files and in subfolders
- Subject: Re: Setting filename of files and in subfolders
- From: Bill Briggs <email@hidden>
- Date: Mon, 14 May 2001 11:43:01 -0300
At 9:16 AM -0500 14/05/01, T.J. Mahaffey wrote:
on changeLabels(theFolder)
tell application "Finder"
activate
set theseFolderItems to every item in theFolder
repeat with thisItem in theseFolderItems
set name of thisItem to ((name of thisItem) - (".jpg" as text))
end repeat
end tell
end changeLabels
You can't "subtract" strings literally in AppleScript. You can strip
the undesired ".jpg" with this bit, but you should also be checking
to make sure that you are only operating on files (and only ones that
have the extension you want to eliminate), not folders.
tell application "Finder"
set theseFolderItems to every item in theFolder
repeat with thisItem in theseFolderItems
set oldName to (name of thisItem)
set theOffset to (offset of "." in oldName)
set newName to (text 1 through (theOffset - 1)) of oldName
end repeat
end tell
- web