473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Find Highest File Name

I have a web application where I am displaying the current inmate
population for the county jail. Part of the information that I
display is the mugshot. Unfortunately, they have changed the way the
mugshots are being named. So I need to read a directory and get the
newest image. The problem is that I can use the Create or Modified
Date.

Here is an example of what I have:
4580.001.jpg
4580.002.jpg
4580.003.jpg
etc.
etc.

The "4580" corresponds to the inmate and the ".001" is just a
sequential number for multiple mugshots of the same inmate. The ".
003" tells me that this is the latest image. Without knowing what
this number may be, is there an easy way to always retrieve the newest
image?

Any help that you can offer will be greatly appreciated. They are on
my back to get this back online and this is the only issue left for me
to resolve.

Mark

Oct 3 '07 #1
3 1627
Based on what you have written, the count of files that matches the pattern
InmateNumber.*.jpg, should be the same as the highest value. If there are
gaps in the sequence however, this won't be true.

"ma******@Hotmail.com" wrote:
I have a web application where I am displaying the current inmate
population for the county jail. Part of the information that I
display is the mugshot. Unfortunately, they have changed the way the
mugshots are being named. So I need to read a directory and get the
newest image. The problem is that I can use the Create or Modified
Date.

Here is an example of what I have:
4580.001.jpg
4580.002.jpg
4580.003.jpg
etc.
etc.

The "4580" corresponds to the inmate and the ".001" is just a
sequential number for multiple mugshots of the same inmate. The ".
003" tells me that this is the latest image. Without knowing what
this number may be, is there an easy way to always retrieve the newest
image?

Any help that you can offer will be greatly appreciated. They are on
my back to get this back online and this is the only issue left for me
to resolve.

Mark

Oct 3 '07 #2
RB
Family Tree Mike wrote:
Based on what you have written, the count of files that matches the pattern
InmateNumber.*.jpg, should be the same as the highest value. If there are
gaps in the sequence however, this won't be true.

"ma******@Hotmail.com" wrote:
>I have a web application where I am displaying the current inmate
population for the county jail. Part of the information that I
display is the mugshot. Unfortunately, they have changed the way the
mugshots are being named. So I need to read a directory and get the
newest image. The problem is that I can use the Create or Modified
Date.

Here is an example of what I have:
4580.001.jpg
4580.002.jpg
4580.003.jpg
etc.
etc.

The "4580" corresponds to the inmate and the ".001" is just a
sequential number for multiple mugshots of the same inmate. The ".
003" tells me that this is the latest image. Without knowing what
this number may be, is there an easy way to always retrieve the newest
image?

Any help that you can offer will be greatly appreciated. They are on
my back to get this back online and this is the only issue left for me
to resolve.

Mark

If there are gaps in the sequence, presumably you could just iterate
through every file matching the pattern "4580.*.jpg", and keep a record
of the highest value:

Something along these lines:
Psuedo-code:

dim iHighest, iCurrent as integer
For Each filename matching InmateNumber & ".*.jpg"
'Get the photo ordinal
iCurrent = Integer.Parse(filename.split(".")(1))
if iHighest < iCurrent then
iHighest=iCurrent
End if
Next

dim sNewestFile as string = InmateNumber & "." & iHighest & ".jpg"
Oct 3 '07 #3
Filter by the first number and cycle through checking creation date and
time.

Sorry for the short response (no code) but I am typing one handed beacuse I
have a sick cat in laying in the other arm :)

<ma******@Hotmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
>I have a web application where I am displaying the current inmate
population for the county jail. Part of the information that I
display is the mugshot. Unfortunately, they have changed the way the
mugshots are being named. So I need to read a directory and get the
newest image. The problem is that I can use the Create or Modified
Date.

Here is an example of what I have:
4580.001.jpg
4580.002.jpg
4580.003.jpg
etc.
etc.

The "4580" corresponds to the inmate and the ".001" is just a
sequential number for multiple mugshots of the same inmate. The ".
003" tells me that this is the latest image. Without knowing what
this number may be, is there an easy way to always retrieve the newest
image?

Any help that you can offer will be greatly appreciated. They are on
my back to get this back online and this is the only issue left for me
to resolve.

Mark

Oct 4 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dirtyweeker | last post by:
Hi, I have a database which records fitness test results of pupils. There are the usual name fields and then a series of fields holding results, e.g. field BP1 and field BP2; each of these...
3
by: lostncland | last post by:
I am working on this program. The array has 10 scores. (there is more to this program.) Does the last "for" section make sense? /*Defines a global constant called N throughout the file. ...
6
by: apking | last post by:
please write the programe in c language for this Accept 5 Employee details to find highest salary employe name using for loop and arrays Thanks in advance
13
by: td0g03 | last post by:
Hello again guys. I have a question. I'm working on a program for my class and I'm stuck on how to find the lowest and highest number of a user input. We aren't at arrays yet so that's out of the...
2
by: dobbine | last post by:
hi there folks, I was wondering if I have a folder with the following files in it, can I return 00012a.jpg? 00012.jpg 00012a.jpg 00012b.jpg 00012c.jpg right up to ... 00012z.jpg
3
by: dobbine | last post by:
hi there folks, I was wondering if I have a folder with the following files in it, can I return 00012ac.jpg? 00012.jpg 00012a.jpg 00012b.jpg 00012c.jpg right up to ...
1
by: mrpknd57 | last post by:
Hi, I am new to Access/VBA can anyone help? I have a form with a button that runs a macro. I have been using the TransferText action within the macro to import a text file, from a specific...
6
by: Wayne | last post by:
I'm using the following SQL statement to find the next highest autonumber value in a table where "CDUGActID is the autonumber field in the "CDUGActuals" table: SELECT CDUGActuals.CDUGActID,...
1
by: eraserwars | last post by:
My compiler keeps saying LNK2019, and my teacher says to look for spelling error. He says that most likely what is happening is that a spelling error is messing my program up. I searched, and I did...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.