Find Highest File Name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • markcash@Hotmail.com

    #1

    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

  • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

    #2
    RE: Find Highest File Name

    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.

    "markcash@Hotma il.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
    >
    >

    Comment

    • RB

      #3
      Re: Find Highest File Name

      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.
      >
      "markcash@Hotma il.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(f ilename.split(" .")(1))
      if iHighest < iCurrent then
      iHighest=iCurre nt
      End if
      Next

      dim sNewestFile as string = InmateNumber & "." & iHighest & ".jpg"

      Comment

      • Ray Cassick

        #4
        Re: Find Highest File Name

        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 :)

        <markcash@Hotma il.comwrote in message
        news:1191370687 .970436.113910@ 22g2000hsm.goog legroups.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
        >

        Comment

        Working...