• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting filename of files and in subfolders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Setting filename of files and in subfolders (From: "T.J. Mahaffey" <email@hidden>)
 >Re: Setting filename of files and in subfolders (From: Bill Briggs <email@hidden>)

  • Prev by Date: Re: Setting filename of files and in subfolders
  • Next by Date: Re: Scientific notation to text
  • Previous by thread: Re: Setting filename of files and in subfolders
  • Next by thread: OSA Events
  • Index(es):
    • Date
    • Thread