Re: Reverse numerotation of files !
- From: "Jeremy" <matthieu_in_hk@xxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 14:20:03 +0900
I see...
So what should I do to make it work ?
"Al Dunbar [MS-MVP]" <alan-no-drub-spam@xxxxxxxxxxx> wrote in message
news:uVFCFVseFHA.1504@xxxxxxxxxxxxxxxxxxxxxxx
> I'd guess it is because the set/a command interprets any number with a
> leading zero digit as it if were an octal or base eight number. Base 8
> digits include '0' through '7', but do not include '8' or '9'
>
> /Al
>
> "Jeremy" <matthieu_in_hk@xxxxxxxxxxx> wrote in message
> news:eOE7p7reFHA.1036@xxxxxxxxxxxxxxxxxxxxxxx
> > Hi William
> >
> > Thanks for your script.
> > I've been testing it.
> > It works good, but for numbers 8 and 9, it doesn't work.
> > Do you know why ?
> >
> > Thanks
> > Jeremy.
> >
> >
> > "William Allen" <_wa_@xxxxxxxxx> wrote in message
> > news:42b7eac0$0$3134$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > > "Jeremy" wrote in message
> > > > Hello,
> > > >
> > > > I have many files in one folder. Here is one exemple of file name :
> > > > pics - 05/02/2005 001.jpg
> > > > ...
> > > > pics - 05/02/2005 300.jpg
> > > >
> > > > I wish I could reverse the numerotation of the files :
> > > > pics - 05/02/2005 001.jpg will become pics - 05/02/2005 300.jpg
> > > > ...
> > > > pics - 05/02/2005 300.jpg will become pics - 05/02/2005 001.jpg
> > > >
> > > > Is it possible ?
> > > > I don't really know how to script but I really need to do that!!
> > > > Could somebody help me please ?
> > >
> > > This demo assumes that all the files match the wildcard pics*.jpg
> > > (where * means any number of characters). It also assumes that
> > > the final numbering characters match a three digit range 001-999.
> > >
> > > It should prompt you for the start number (in your example = 1)
> > > and the finish number (in your example=300) and then rename
> > > each file to (Start+Stop)-(file's current number) with lead zeros for
> > > numbers less than 100. So in your example, 001 becomes 300,
> > > 300 becomes 001 and so on.
> > >
> > > Note that the demo does an intermediate REName to *.JP_
> > > (assumes you have no files with extension .JP_ at present), to
> > > avoid clashing with existing files during the process. At the end
> > > of the run all the *.JP_ files are RENamed back to *.JPG extension.
> > >
> > > Try it out on a few copied example files first to see if it does what
> > > you want.
> > >
> > > Lines that don't begin with two spaces have wrapped accidentally
> > > ====Begin cut-and-paste (omit this line)
> > > @ECHO OFF
> > > SETLOCAL
> > > SET /p START="Enter start of file numbering "
> > > SET /p STOP="Enter end of file numbering "
> > > SET /a TOGGLE=%START%+%STOP%
> > > :: Assumes files match pics*.jpg
> > > FOR %%F IN (pics*.jpg) DO CALL :_RENAME "%%F"
> > > ECHO. Renaming all *.JP_ to *.JPG
> > > REN *.JP_ *.JPG
> > > GOTO :EOF
> > >
> > > :_RENAME
> > > SET BN=%~n1
> > > SET FirstPart=%BN:~0,-3%
> > > SET LastThree=%BN:~-3%
> > > SET /a LastThree=1000+%TOGGLE%-%LastThree%
> > > SET LastThree=%LastThree:~-3%
> > > ECHO. Renaming %1 to "%FirstPart%%LastThree%.JP_"
> > > REN %1 "%FirstPart%%LastThree%.JP_"
> > >
> > > ====End cut-and-paste (omit this line)
> > > Simulated Win2000 for study/demo use. Cut-and-paste as Batch text
file.
> > > Batch file troubleshooting:
http://www.allenware.com/find?UsualSuspects
> > >
> > > --
> > > William Allen
> > > Free interactive Batch Course
http://www.allenware.com/icsw/icswidx.htm
> > > Batch Reference with examples
http://www.allenware.com/icsw/icswref.htm
> > > Header email is rarely checked. Contact us at
http://www.allenware.com/
> > >
> > >
> >
> >
>
>
.
- Follow-Ups:
- Re: Reverse numerotation of files !
- From: William Allen
- Re: Reverse numerotation of files !
- References:
- Reverse numerotation of files !
- From: Jeremy
- Re: Reverse numerotation of files !
- From: William Allen
- Re: Reverse numerotation of files !
- From: Jeremy
- Re: Reverse numerotation of files !
- From: Al Dunbar [MS-MVP]
- Reverse numerotation of files !
- Prev by Date: Re: DNS Help- Urgent
- Next by Date: Resize the image by Batch Mode
- Previous by thread: Re: Reverse numerotation of files !
- Next by thread: Re: Reverse numerotation of files !
- Index(es):