• 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: Renaming files/folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming files/folders


  • Subject: Re: Renaming files/folders
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 5 Sep 2001 06:29:32 -0700

On 9/4/01 11:31 PM, Ray Phillips <email@hidden> wrote:

>I've written a script for a droplet which alters the names of any files and
>folders (and their contents) which are dragged onto it so the become valid
>for a FAT file system. (It removes any trailing spaces and periods, and
>replaces any of these characters \ / * ? \ " < > | with '-'.)

That shouldn't take a 200-line script. Here's a much shorter one that
should do what you need. I haven't tested it, though.

--Michelle

on open (DroppedItems)
set the filestochange to the files of the DroppedItems
repeat with thisFile in filestochange
tell application "Finder"
set the NameToChange to the name of thisFile
end tell
set tid to text item delimiters
change(NameToChange, "\\")
change(NameToChange, "/")
change(NameToChange, "*")
change(NameToChange, "?")
change(NameToChange, "\"")
change(NameToChange, "<")
change(NameToChange, ">")
change(NameToChange, "|")
set text item delimiters to tid
tell application "Finder"
set the name of thisFile to the NameToChange
end tell
end repeat
end open

on change(inString, inChar)
set text item delimiters to the inChar
set tempList to text items of the inString
set text item delimiters to "-"
set the outstring to tempList as text
return the outstring
end change

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Follow-Ups:
    • Re: Renaming files/folders
      • From: Ray Phillips <email@hidden>
    • Re: Renaming files/folders
      • From: Paul Skinner <email@hidden>
    • Re: Renaming files/folders
      • From: "Bob.Kalbaugh" <email@hidden>
  • Prev by Date: Re: Photoshop DCS to eps
  • Next by Date: Re: on login, on logout...
  • Previous by thread: Re: Renaming files/folders
  • Next by thread: Re: Renaming files/folders
  • Index(es):
    • Date
    • Thread