Re: Batch file naming - serialize in reverse
Re: Batch file naming - serialize in reverse
- Subject: Re: Batch file naming - serialize in reverse
- From: Bill Planey <email@hidden>
- Date: Thu, 22 Sep 2005 10:00:13 -0500
- Thread-topic: Batch file naming - serialize in reverse
Mark,
Your solution works very nicely. I simply changed the sourceFolder statement
to :
set sourceFolder to choose folder
...instead of the directory path you provided. Here's how I tested it. I
copied five sample files (01.pdf through 05.pdf) into a test folder. I used
the color labeling feature to make each one a different color (red, orange,
yellow, green, blue in that order) and ran the script. The color labeling
would help me keep track of which file was named what prior to the script
running. When the script was done the files were thus:
01.pdf (blue)
03.pdf (green)
05.pdf (yellow)
07.pdf (orange)
09.pdf (red)
The colors flip-flopped in their order, telling me that the routine worked
properly.
Thanks!
Bill
On 9/21/05 1:43 PM, "Mark J. Reed" <email@hidden> wrote:
> Silly me, tried to do it outside of the Finder. :)
>
> Here's what I came up with. Note that it only works if there are no
> conflicts - if you already have a file of the name it's trying to
> rename something to, it will fail. It might be best if the source and
> destination folders were different to avoid that problem; you could do
> a copy instead of a rename to make sure nothing gets nuked,. too.
>
> set sourceFolder to "Macintosh HD:Users:mreed:New" as alias
>
> tell application "Finder"
> set sourceFiles to (get every file of sourceFolder)
> end tell
>
> set startValue to (count sourceFiles) * 2 - (count sourceFiles) mod 2
> set stepValue to -2
>
> tell application "Finder"
> repeat with aFile in sourceFiles
> set newNum to text -2 through -1 of ("0" & (startValue as string))
> set startValue to startValue + stepValue
> set newName to newNum & ".pdf"
> set aFile's name to newName
> end repeat
> end tell
>
> On 9/21/05, Mark J. Reed <email@hidden> wrote:
>> No, it should be possible, except I can't figure out how to get a list
>> of the files in the first place. "can't get every file of alias
>> blah".
>>
>> On 9/21/05, Bill Planey <email@hidden> wrote:
>>> Hello,
>>>
>>> I have a program named "Filenamer" and another cool utility called "File
>>> List" which allow batch file naming/renaming. Both offer serialization
>>> options, but both only offer this in ascending order. I would like to rename
>>> files that have already been serialized in ascending order to descending
>>> order. For example:
>>>
>>> Starting value: 13
>>> Step value: -2
>>>
>>> 1.pdf > 13.pdf
>>> 2.pdf > 11.pdf
>>> 3.pdf > 09.pdf
>>> 4.pdf > 07.pdf
>>> 5.pdf > 05.pdf
>>> 6.pdf > 03.pdf
>>> 7.pdf > 01.pdf
>>>
>>> The reason for wanting this is to be able to interleave a folder of
>>> front-side page scans with a folder of back-side page scans. The back sides
>>> are scanned last page first, so they would need to be renumbered thus.
>>>
>>> Am I seeking the impossible?
>>>
>>>
>>> Thanks,
>>> Bill Planey
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Applescript-users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
m
>>>
>>> This email sent to email@hidden
>>>
>>
>>
>> --
>> Mark J. Reed <email@hidden>
>>
>
>
> --
> 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:
This email sent to email@hidden