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:56:39 -0300
At 11:43 AM -0300 14/05/01, Bill Briggs wrote:
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
Ooops. That should read.
- web
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
set name of thisItem to newName
end repeat
end tell