• 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 multiple files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming multiple files


  • Subject: Re: Renaming multiple files
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 4 Dec 2008 09:28:47 -0500

Whether you use AS or the shell or something else, the issue is that
the mapping of input names to output names may not be what you expect.

My first instinct would be a shell command something like this:

ls -1 srcdir | perl -ne 'chomp; rename($_, "destdir/$..xls") or die $! '

Translating that into do shell script form is left as an exercise for
the interested reader - the nested quoting makes it trickier than
usual.

(You could use opendir/readdir inside the perl instead of the ls pipe,
but it's wordier that way and you'd have to explicitly sort() the
names to get a reproducible mapping.)




On 12/4/08, Chris Page <email@hidden> wrote:
> On Dec 4, 2008, at 02:40 AM, Miguel Moya wrote:
>
>> -Count the number of files of folder "A".
>> -Starts a repeat command using the number of files.
>> -Takes the first file of this folder, rename it always with the same
>> name (always 1.xls) and move it to folder "B" overwriting the
>> previous file.
>> -Go to the next file.
>
>
> tell application "Finder" to get files of folder "Input Files" of
> desktop returning folderItems
>
> set i to 1
> repeat with f in folderItems
> 	tell application "Finder" to move f to folder "Output Files" of desktop
> 	set the name of the result to (i as text) & ".xls"
> 	set i to i + 1
> end repeat
>
> --
> Chris Page - AppleScripter
>
>   The other, other AppleScript Chris
>
>
>
>

--
Sent from Gmail for mobile | mobile.google.com

Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Renaming multiple files
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Renaming multiple files (From: Miguel Moya <email@hidden>)
 >Re: Renaming multiple files (From: Chris Page <email@hidden>)

  • Prev by Date: Finder folder names
  • Next by Date: Re: Renaming multiple files
  • Previous by thread: Re: Renaming multiple files
  • Next by thread: Re: Renaming multiple files
  • Index(es):
    • Date
    • Thread