Check for ...00xx in file name, ie ('00' -: _4 _3&{), 
if so prefix with 1 otherwise prefix with 0. You get

> DSCF8950.JPG
> DSCF8953.JPG
> DSCF0002.JPG
> DSCF0031.JPG

into

> DSCF08950.JPG
> DSCF08953.JPG
> DSCF10002.JPG
> DSCF10031.JPG





----- Original Message ----
> From: Devon McCormick <[email protected]>
> To: J-programming forum <[email protected]>
> Sent: Saturday, January 17, 2009 7:45:22 PM
> Subject: [Jprogramming] Detecting rollover
> 
> Members of the Forum -
> 
> I have a small practical puzzle - I have a solution for it but am wondering
> if there's a better one.
> 
> When I work with .JPG files from my digital camera, I'll sometimes use the
> sequence numbers embedded in the names, typically something like this:
> 
> DSCF8950.JPG
> DSCF8953.JPG
> DSCF8957.JPG
> 
> and so on.  The problem with using this for sequencing is that sometimes the
> numbers roll over, e.g. 9998, 9999 is followed by 0, 1, 2 etc.  What's a
> good way to detect this?  The sequence of numbers will have gaps because I
> delete pictures from the camera before downloading the files, so sequence
> might be 9995, 9998, 3, 5, 12....
> 
> Currently, I have an expression, where "nn" is the vector of numbers
> extracted from the file names, like this:
> 
>    if. (nn+./ . >5000)*.nn+./ . <999 do. NB. Numbers >9999 and restarted at
> 0?
>        nn=. nn+10000*nn<:5000 end.
> 
> but it's less than elegant, particularly because of the embedded, arbitrary
> limits of 5000 and 999.  I chose these based on the number of pictures I
> might take in one batch versus the number I might have deleted.  So, this
> assumes I'll never hit the roll-over point, take more than 999 more
> pictures, then discard those numbered 0 to 999.  If I did, this check would
> fail even though it shouldn't.  I'm assuming this is unlikely, but it isn't
> impossible.
> 
> Any ideas?
> 
> Regards,
> 
> Devon
> 
> -- 
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to