• 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: delete first 3 characters in a file name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete first 3 characters in a file name


  • Subject: Re: delete first 3 characters in a file name
  • From: Bill White <email@hidden>
  • Date: Thu, 09 Dec 2004 12:32:46 -0500

On 12/9/04 11:40 AM, Jan-Bultereys <email@hidden> wrote:

> select a couple of files in a folder all starting with 001_test, 103_test2,
> 203_test3 for example then rename them to test1, test2, test3.....

You're actually getting rid of *four* characters because the underscore is
in there. If you're selecting the files manually, then simplistically this
will do it:

tell application "Finder"

    set theFiles to the selection

    repeat with i from 1 to count theFiles

        set oldName to name of item i of theFiles
        set newName to characters 5 thru -1 of oldName as string
        set name of item i of theFiles to newName

    end repeat

end tell

There's no error checking here, but it should get you started.

-- Bill


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: delete first 3 characters in a file name
      • From: Michelle Steiner <email@hidden>
References: 
 >delete first 3 characters in a file name (From: "Jan-Bultereys" <email@hidden>)

  • Prev by Date: Re: delete first 3 characters in a file name
  • Next by Date: Re: Unwinding the containment hierarchy of a reference
  • Previous by thread: Re: delete first 3 characters in a file name
  • Next by thread: Re: delete first 3 characters in a file name
  • Index(es):
    • Date
    • Thread