rename files that are out of order?

G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.general (More info?)

Not sure where to post this question, so I tried this forum. I have about
16000 tif files. the names of the files are 00048000.tif through
00064000.tif. but all files are not in squence. As an example there maybe a
file 00050551.tif and the next file might be 00050566.tif, the files in
between don't exist. The problem is that the squence is out of order with a
database. I need a way to add 3432 to each tif file, in other words take the
existing filename plus 3432 = the new filename. I looked at some renamers,
but they don't have an option to add a number to a filename. Any ideas how
this can be done?

thanks
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.general (More info?)

Piece of piss to do in windows, where are these files?

--
--------------------------------------------------------------------------------------------------
http://webdiary.smh.com.au/archives/_comment/001075.html
=================================================
"mwm" <mwm@discussions.microsoft.com> wrote in message news:430E2919-B239-42CB-B9BE-D181B4F9279E@microsoft.com...
> Not sure where to post this question, so I tried this forum. I have about
> 16000 tif files. the names of the files are 00048000.tif through
> 00064000.tif. but all files are not in squence. As an example there maybe a
> file 00050551.tif and the next file might be 00050566.tif, the files in
> between don't exist. The problem is that the squence is out of order with a
> database. I need a way to add 3432 to each tif file, in other words take the
> existing filename plus 3432 = the new filename. I looked at some renamers,
> but they don't have an option to add a number to a filename. Any ideas how
> this can be done?
>
> thanks
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.general (More info?)

"mwm" <mwm@discussions.microsoft.com> wrote in message
news:430E2919-B239-42CB-B9BE-D181B4F9279E@microsoft.com...
> Not sure where to post this question, so I tried this forum. I have about
> 16000 tif files. the names of the files are 00048000.tif through
> 00064000.tif. but all files are not in squence. As an example there maybe
> a
> file 00050551.tif and the next file might be 00050566.tif, the files in
> between don't exist. The problem is that the squence is out of order with
> a
> database. I need a way to add 3432 to each tif file, in other words take
> the
> existing filename plus 3432 = the new filename. I looked at some renamers,
> but they don't have an option to add a number to a filename. Any ideas how
> this can be done?
>
> thanks

If I interpret this correctly, you want to change the filename sequence
00048000.tif to 00064000.tif to the sequence 00051432.tif to 00067432.tif
where some of the numbers in the sequence are missing.

* Presuming that the files 00064001.tif to 00067432.tif do not already
exist, then the following batch file should do the trick:

--- add3432.bat begins -----
@echo off
cd [wherever you keep your .tif files]
:: rename files from 64000 back to 48000
for /l %%i in (64000,-1,48000) do call :ren3432 %%i
for %%i in (ynn yon) do set %%i=
goto :eof

:ren3432
:: convert number to 9-digit string - Old Name
set /a yon=100000000+%1
:: add 3432 to get New Name
set /a ynn=%yon%+3432
:: only interested in the last 8 characters of name
set yon=%yon:~1%
set ynn=%ynn:~1%
:: if the Old Name exists, rename it to the New Name
if exist %yon%.tif ECHO ren %yon%.tif %ynn%.tif
goto :eof
--- add3432.bat ends -----

Simply cut the above between the lines
--- add3432.bat ends -----
and
--- add3432.bat begins -----

and paste them into a file called ADD3432.BAT after changing [wherever you
keep your .tif files] to the appropriate path and execute ADD3432.BAT

** Note 1: The ECHO in the second-last line will simply report to the screen
what the batch wants to do. Edit-out the word ECHO to actually perform the
rename operation.
** Note 2: Suggest that you change the numbers from (64000,-1,48000) to
(50570,-1,50549) with the ECHO in place to test that the program is working
correctly. The program should report that it wants to rename
00050570..00050566 and 00050551..00050549 (since 00050565..00050552 are
missing) - it's a whole lote easier than trying to read the entire list
00064000...00048000

(alt.msdos.batch.nt is an appropriate group for batch methodologies)

HTH

....Bill
 

TRENDING THREADS