• 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: Batch file naming - serialize in reverse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Batch file naming - serialize in reverse


  • Subject: Re: Batch file naming - serialize in reverse
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 21 Sep 2005 14:43:10 -0400

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:
> >
> > 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

  • Follow-Ups:
    • Re: Batch file naming - serialize in reverse
      • From: Bill Planey <email@hidden>
    • Re: Batch file naming - serialize in reverse
      • From: Bill Planey <email@hidden>
References: 
 >Batch file naming - serialize in reverse (From: Bill Planey <email@hidden>)
 >Re: Batch file naming - serialize in reverse (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Batch file naming - serialize in reverse
  • Next by Date: Re: Batch file naming - serialize in reverse
  • Previous by thread: Re: Batch file naming - serialize in reverse
  • Next by thread: Re: Batch file naming - serialize in reverse
  • Index(es):
    • Date
    • Thread