Re: Renaming multiple files
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