• 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: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


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

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