comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Processing about 10,000 tif files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Processing about 10,000 tif files [message #91024 is a reply to message #91010] Tue, 26 May 2015 19:05 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
On Sunday, May 24, 2015 at 8:23:14 PM UTC-5, andrew...@gmail.com wrote:
>
> How about just rename the files img_00001.tif to img_09999.tif? Solve many problems in a very few lines of code.
>
> And while you're at it, insert some useful coefficients and offsets ino the filenames too.
>
> Andrew

Code below will rename all files so that they can be found in order:

f=file_search('img_*.tif', count=n)
max=20000 ;<--- this should be larger than your max
nzeros = ceil(alog10(max)) > 0
myformat = '(i0'+strcompress(nzeros, /re)+')'

for i=0L,n-1 do print, f[i],' -> ', 'img_'+string((strsplit(file_basename(f[i], '.tif'), '_', /ex))[1], format = myformat)+'.tif'

If you like the above, run it like so:

for i=0L,n-1 do file_move, f[i], 'img_'+string((strsplit(file_basename(f[i], '.tif'), '_', /ex))[1], format = myformat)+'.tif'


G
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3D point cloud visualization
Next Topic: Stretch color image with colorbar compatible issue

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 10:02:27 PDT 2025

Total time taken to generate the page: 0.47921 seconds