Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text bottom

RENPHOT  PowerBASIC  Procedure

         

This is initial publication of RENPHOT(4.0) in 2004.  Latest RENPHOT(5.0) provides additional provisions for easy transition between 8.3 names ans LFNs.

RENPHOT procedure (external 16-bit program executable from DOS/Windows command session) generates unique names for image files recorded by a digital camera basing on date-time stamps contained within files.

Direct dependencies:

DAY2GRE$ Convert absolute day number into Gregorian date
DIGITAL% Check character string for digital value (predicate)
GRE2DAY& Convert Gregorian date into absolute day number
PARSE% Parse character string into substring array
TRANS$ Translate character string symbols
WEEKDAY$ Form day of a week abbreviated name

Indirect dependencies:

COMPRES$ Compress character string
LEAP% Check year for leap value (predicate)
VALDGRE% Check date for valid Gregorian value (predicate)

You can get more details about RENPHOT program origins, design and usage in the Download section.



 RENPHOT  Source  Program                           Debugging data               Debugging logouts

      ' RENPHOT(4.0)  Rename Digital Photo Image JPG Files   01/18/1999-10/25/2004
      ' --------------------------------------------------------------------------
      ' Copyright (C) 1999-2004 by Vladimir Veytsel                  www.davar.net

      ' Type ---------------------------------------------------------------------

      '    Procedure

      ' Description --------------------------------------------------------------

      '    Program generates unique names for image files recorded by a digital
      '    camera basing on date-time stamps contained within files.  Generated
      '    file names are unique only within the given year - it's not much of a
      '    trouble to separate files between years, while this limitation permits
      '    to maintain the most universal 8.3 naming standard.  Ideally a digital
      '    camera itself should do this job, but file naming seems to be of a
      '    little concern for camera designers.

      '    Program reads all not entirely digitally named *.JPG files within the
      '    CURRENT directory and renames those that have recorded date and time
      '    stamp (non-zero).  Recorded date and time can be adjusted by a fixed
      '    value to handle the situation when pictures were taken in a time zone
      '    different from one where camera clock was set, or to correct error of
      '    the camera clock.  Along with file renaming program appends records
      '    to the DESCRIPT.ION file providing initial description approximations
      '    (with optional global comment) that can be adjusted manually later.

      ' Parameters (Up to 7 Positional Self-Delimited) ---------------------------

      '    1. Global description comment to be added to every description line
      '       (might be handy as an event or place identification that can be
      '       later individually adjusted as necessary for selected images).

      '    2. Date-time stamp delimiter recorded by the camera (Default: ":").

      '    3. Number of date-time stamp entry to select (Default: 2).  Camera
      '       usually writes several dates (Olympus writes 3, for example) and
      '       certain investigation and trial might be required to determine what
      '       date-time stamp is the most reliable (for Olympus D400 it happens
      '       to be the 2-nd date).

      '    4. Name of the last file from the previous memory cartridge in the form
      '       of an eight-digit number "MODAHRUT" (Default or invalid: none).
      '       This parameter might prove handy for downloading and renaming images
      '       from several successive memory cartridges in case of a high frequency
      '       of shots made at the end of one cartridge that results in the
      '       incremental shift of file name numbers, so that this shift carries
      '       over into the next cartridge.  This might happen because it's
      '       necessary to download separate cartridges into separate directories
      '       - camera provides unique names only within its current cartridge.
      '       There's always a choice, of course, not to use this parameter, but
      '       to do necessary image file name adjustments manually when merging
      '       individual cartridge directories together.

      '    5. Date translation pattern (Default: "MO/DA/CNYE")
      '       Date is recorded by the camera as "CNYE:MO:DA" (":" stands here
      '       for the camera-recorded date-time stamp delimiter), where:
      '          CN  - Current century
      '          YE  - Year  of current century
      '          MO  - Month of current year
      '          DA  - Day   of current month
      '       Pattern for the date to be written to the corresponding line of
      '       DESCRIPT.ION file can be composed of above listed date fields
      '       and any delimiters different from DAMOYECN characters, e.g.:
      '       MO/DA/CNYE  or  MO/DA/YE
      '       DA.MO.CNYE  or  DA.MO.YE
      '       CNYE-MO-DA  or  YE-MO-DA, etc.

      '    6. Time translation pattern (Default: "HR:UT")
      '       Time is recorded by the camera as "HR:UT:SZ" (":" stands here
      '       for the camera-recorded date-time stamp delimiter), where:
      '          HR  - Hour   of current day
      '          UT  - Minute of current hour
      '          SZ  - Second of current minute
      '       Pattern for the time to be written to the corresponding line of
      '       DESCRIPT.ION file can be composed of above listed time fields
      '       and any delimiters different from HRUTSZ characters, e.g.:
      '       HR:UT:SZ  or  HR:UT
      '       HR.UT.SZ  or  HR.UT
      '       HR-UT/SZ  or  HR-UT, etc.

      '    7. Time adjustment increment/decrement (Default: none), e.g.:
      '       +08:00  or   -02:30  - Should have fixed sHR:UT format, when specified.
      '       HR<=12  and  UT<=59  - Invalid parameter (format or value) is ignored.
      '       Time adjustment comes handy in case you've been travelling, and taking
      '       pictures in another time zone, but didn't adjust the camera clock
      '       (who does?).  This might be a minor annoyance, but why not to fix it
      '       in the same run with image files' renaming?
      '       It's sufficient, of course, to have only hours for time zone adjustment;
      '       minutes are added just in case it would be desirable to correct an error
      '       of the camera clock.
      '       Be careful with the sign setting; you've got to have it "+", if
      '       pictures were taken East of the location where camera clock was set
      '       (things happen "earlier" there), and "-", if pictures were taken West.

      '    Note: In order to permit any symbols within global description comment,
      '          and to accommodate for any possible recorded date-time stamp
      '          delimiter, and any delimiters within date and time patterns,
      '          parameter string is treated as being self-delimited, i.e. its
      '          FIRST symbol is used as the delimiter of individual parameters.
      '          It is up to the user to specify delimiter with the parameters
      '          and to choose it carefully to avoid parameter misinterpretation.

      '          RENPHOT                              - All parameters defaulted
      '          RENPHOT _Comment, etc.               - Symbol "_" is the delimiter
      '          RENPHOT /Comment, etc./:             - Symbol "/" is the delimiter
      '          RENPHOT \Comment, etc.\:\1           - Symbol "\" is the delimiter
      '          RENPHOT |Comment, etc.|:|3|04121443  - Symbol "|" is the delimiter

      ' Action -------------------------------------------------------------------

      '  - Reads date and time stamp from every *.JPG file in the CURRENT directory
      '    in the form of CNYE:MO:DA HR:UT:SZ (":" is assumed to be date delimiter).

      '  - Renames each file into MODAHRUT.JPG using data from date and time stamp.
      '                           +>+>+>+>
      '                           | | | v
      '                           | | v Minute (can be incremented over 59 to 99)
      '                           | v Hour (can be incremented over 23, if required)
      '                           v Day
      '                           Month

      '  - In case such name already exists, name is incremented by "+1" until
      '    proper vacant name slot is found (the ACTUAL time is placed in the
      '    description record).  Such incrementing might move the minute field
      '    over 59 to 99 and under very rare circumstances hour field over 23.
      '    (It's not a big deal to keep file name always as a proper date, but
      '    it might tend to propagate the shift beyond month and even beyond year,
      '    which doesn't make any sense.)

      '  - Image description record is appended to DESCRIPT.ION file for future
      '    use as ACDSee and 4DOS description line.  Description record has the
      '    following format (includes WeeK Day identification):
      '    MODAHRUT.JPG WKD MO/DA/CNYE HR:UT  [<global_description_comment>]

      '    Note:  Date and time are translated according to the default pattern
      '           in the above example.  Alternative translation patterns can be
      '           specified.

      ' Notes --------------------------------------------------------------------

      '  - Program is designed to operate within CURRENT directory.

      '  - Important presumption is that file names written by the camera are not
      '    entirely digital (E.g.: they start with "P" for Olympus).

      '  - If file name is entirely digital (except for ".JPG" extension) no
      '    action is taken for such file.  This ensures that partially processed
      '    directories can be entirely reprocessed safely to rename only what is
      '    required.

      '  - Program relies on the metadata with the date-time stamp that gets
      '    written at the beginning of the *.JPG image file by a digital camera.
      '    If date and time stamp is not found or it is all zeros, no action is
      '    taken for such file (camera should be set to write date and time to
      '    image file). To check the presence of metadata and date-time stamp
      '    view *.JPG file as text.

      '  - Renaming of image files should be done right after unloading them from
      '    the camera to the computer.  If you plan to use RENPHOT, it should be
      '    the very FIRST processing step.  Image processing programs such as
      '    ACDSee or PhotoShop remove camera-recorded metadata (they give warning,
      '    however), and date-time stamp gets lost, making operation of RENPHOT
      '    impossible (running it anyway won't spoil anything - files simply won't
      '    be renamed).

      '  - Beginning of the date-time stamp is identified by the program as four
      '    successive digits starting with "19" or "20" followed by the date
      '    delimiter, E.g.:  "19yy:" or "20yy:".

      '  - Program looks for date-time stamp only within first 1000 symbols of
      '    *.JPG file.  If the number of date-time entry specified by the 3-rd
      '    parameter is not found, file is not renamed.

      ' External SubProgram Library ----------------------------------------------

           $LINK "MODULE.PBL"

      ' External Function --------------------------------------------------------

           DECLARE FUNCTION DAY2GRE$(Day.Numb&)
           DECLARE FUNCTION DIGITAL%(Strng$,Delim$)
           DECLARE FUNCTION GRE2DAY&(Greg.Date$)
           DECLARE FUNCTION PARSE%  (Strng$,SubStr$(),Delim$)
           DECLARE FUNCTION TRANS$  (Strng$,Source$,Target$)
           DECLARE FUNCTION WEEKDAY$(Spec.Date$)

      ' Start Procedure ----------------------------------------------------------

           DEFINT A-Z     ' All defaulted variables are integer
           OPTION BASE 1  ' Default array indexation starts from "1"

      ' Constant -----------------------------------------------------------------

           Q$=CHR$(34)  ' Quotation mark

      ' Working Variable ---------------------------------------------------------

           DIM Parameter$(7)

      ' Get Control Parameters ---------------------------------------------------

           Parm$=COMMAND$
      '    Parm$=""
      '    Parm$="_Comment 1, etc."
      '    Parm$="/Comment 2, etc./:"
      '    Parm$="\Comment 3, etc.\:\1"
      '    Parm$="|Comment 4, etc.|:|3|04121443"
      '    Parm$="+Comment 5, etc.+:+3+04121443+CNYE-MO-DA"
      '    Parm$="-Comment 6, etc.-:-3-04121443-DA.MO.CNYE-HR.UT.SZ"
      '    Parm$="*Comment 7, etc.*:*3*04121443"
      '    Parm$="/Comment 8, etc.//////+10:10"
      '    Parm$="/Comment 9, etc.//////-01:01"

           I=PARSE%(Parm$,Parameter$(),"*")

      ' Form Parameters' Actual Values -------------------------------------------

           Descr$   =Parameter$(1)
           Delim$   =Parameter$(2)
           Entry=VAL(Parameter$(3))
           Prev$    =Parameter$(4)
           Date.Pat$=Parameter$(5)
           Time.Pat$=Parameter$(6)
           Time.Adj$=Parameter$(7)

      ' Display Renaming Log Title -----------------------------------------------

           PRINT "RENPHOT(4.0)  Rename Digital Photo Image JPG Files  ";DATE$;
           PRINT "  ";LEFT$(TIME$, 5)
           PRINT STRING$(69,"-")

      ' Adjust Control Parameters ------------------------------------------------

           IF (Delim$="") THEN Delim$=":" :Delim$=LEFT$(Delim$,1)
           IF (Entry =0 ) THEN Entry =2

           IF (Date.Pat$="") THEN Date.Pat$="MO/DA/CNYE"
           IF (Time.Pat$="") THEN Time.Pat$="HR:UT"

           IF ((LEN(Prev$)<>8)OR _
               (NOT(DIGITAL(Prev$,"")))) THEN
              Prev$=""
           END IF

           Rec.Dt.Tm.Pat$="CNYE"+Delim$+"MO"+Delim$+"DA HR"+Delim$+"UT"+Delim$+"SZ"

           IF (LEN(Time.Adj$)>0) THEN
              Sign.Adj$=LEFT$(Time.Adj$,1)
              IF ((LEN(Time.Adj$)=6)        AND _  ' ----+-
                  (VERIFY(Sign.Adj$,"-+")=0)AND _  ' +12:34
                  (MID$(Time.Adj$,4,1)=":") AND _
                  (DIGITAL(MID$(Time.Adj$,2,2)+RIGHT$(Time.Adj$,2),""))) THEN
                 Hours.Adj  =VAL(  MID$(Time.Adj$,2,2))
                 Minutes.Adj=VAL(RIGHT$(Time.Adj$,2))
                 IF ((Hours.Adj<=12)AND _
                     (Minutes.Adj<=59)) THEN
                    Minutes.Incr=Hours.Adj*60+Minutes.Adj
                    IF (Sign.Adj$="-") THEN
                       Minutes.Incr=Minutes.Incr*(-1)
                    END IF
                    PRINT "Note: Time of each picture will be adjusted by the value of ";Q$;Time.Adj$;Q$
                 ELSE
                    PRINT "Invalid time adjustment parameter value[s]: ";Q$;Time.Adj$;Q$;"  - Ignored"
                 END IF
              ELSE
                 PRINT "Invalid time adjustment parameter format: ";Q$;Time.Adj$;Q$;"  - Ignored"
              END IF
           END IF

      ' Open Directory Description File ------------------------------------------

           OPEN "DESCRIPT.ION" FOR APPEND AS #1

      ' Process All Files in Current Directory (Having Non-Digital Name) ---------

           ON ERROR RESUME NEXT      ' Bypass system action on file renaming error

           File.Name$=DIR$("*.JPG")  ' Get first file name

           DO UNTIL (File.Name$="")
              IF (NOT(DIGITAL(LEFT$(File.Name$,8),""))) THEN
                 GOSUB Process.File
              END IF
              File.Name$=DIR$        ' Get next  file name
           LOOP

      ' Finish Program -----------------------------------------------------------

           PRINT "********"
           CLOSE
           END

      Process.File:  ' Routine ---------------------------------------------------

           GOSUB Get.Date.Time

           IF ((LEN(Date.Time$)>0)AND _  ' File contains date and time stamp
               (DIGITAL(Date.Time$," "+Delim$))) THEN
              GOSUB Form.New.Name
              IF ((New.Name$<>"00000000")AND _
                  (File.Name$<>New.Name$+".JPG")) THEN
                 GOSUB Rename.File
                 GOSUB Append.Descr
              END IF
           END IF

           RETURN  ' From Process.File routine

      Get.Date.Time:  ' Routine --------------------------------------------------

           OPEN File.Name$ FOR BINARY AS #2

           I&=1
           FOR J=1 TO Entry
               Year$="****"
               FOR I&=I& TO 1000    ' Find the nearest date delimiter
                   GET$ #2,1,Symb$  ' which follows 4 digits (19yy or 20yy)
                   Year$=RIGHT$(Year$+Symb$,5)
                   IF ((Symb$=Delim$)         AND _
                       (DIGITAL(Year$,Delim$))AND _
                       (( LEFT$(Year$,2)="19")OR  _
                        ( LEFT$(Year$,2)="20"))) THEN
                      EXIT
                   END IF
               NEXT I&
               IF (J<>Entry) THEN
                  I&=I&+15
                  SEEK #2,I&  ' Skip date and time stamp
               END IF
           NEXT J

           SEEK #2,I&-4+(Entry=1)
           GET$ #2,19,Date.Time$

           CLOSE #2

      '    ----+----1----+----  Time adjustment is below
      '    2002:04:21 10:10:36  Date.Time$ format example

           File.Date.Time$=Date.Time$  ' Save for displaying in renaming log
           IF (Minutes.Incr<>0) THEN
              Minutes.Abs&=GRE2DAY&(MID$(Date.Time$, 6,5)+":"   + _
                                   LEFT$(Date.Time$,   4))*24*60+ _
                                VAL(MID$(Date.Time$,12,2))   *60+ _
                                VAL(MID$(Date.Time$,15,2))

              Minutes.Abs&=Minutes.Abs&+Minutes.Incr

              Hours.Abs&=INT(Minutes.Abs&/60)
              MID$(Date.Time$,15,2)=RIGHT$("0"+LTRIM$(STR$(Minutes.Abs& MOD 60)),2)
              Days.Abs&=INT(Hours.Abs&/24)
              MID$(Date.Time$,12,2)=RIGHT$("0"+LTRIM$(STR$(Hours.Abs& MOD 24)),2)
              Adjusted.Date$=DAY2GRE$(Days.Abs&)
              MID$(Date.Time$,1,10)=RIGHT$(Adjusted.Date$,4)+":"+LEFT$(Adjusted.Date$,5)
              MID$(Date.Time$,8,1)=":"  ' Adjust delimiter
           END IF

           RETURN  ' From Get.Date.Time routine

      Form.New.Name:  ' Routine --------------------------------------------------

           New.Name$=TRANS$("MODAHRUT",Rec.Dt.Tm.Pat$,Date.Time$)

           IF (New.Name$=Prev$) THEN  ' Increment name number to avoid duplicate
               New.Name$=RIGHT$("0"+LTRIM$(STR$(VAL(New.Name$)+1)),8)
           END IF

           RETURN  ' From Form.New.Name routine

      Rename.File:  ' Routine ----------------------------------------------------

           Renamed=0
           DO UNTIL (Renamed)
              NAME File.Name$ AS New.Name$+".JPG"
              IF (ERRTEST=58) THEN  ' New.Name$ already exists
                 New.Name$=RIGHT$("0"+LTRIM$(STR$(VAL(New.Name$)+1)),8)
              ELSE
                 PRINT File.Name$;" --> ";New.Name$;".JPG  ";File.Date.Time$
                 Renamed=-1
              END IF
           LOOP

           RETURN  ' From Rename.File routine

      Append.Descr:  ' Routine ---------------------------------------------------

           PRINT #1,New.Name$;".JPG "                                        ; _
                    WEEKDAY(TRANS$("MO-DA-YE",Rec.Dt.Tm.Pat$,Date.Time$));" "; _
                            TRANS$(Date.Pat$ ,Rec.Dt.Tm.Pat$,Date.Time$) ;" "; _
                            TRANS$(Time.Pat$ ,Rec.Dt.Tm.Pat$,Date.Time$);"  "; _
                            Descr$

           RETURN  ' From Append.Descr routine
  
         

 RENPHOT  Debugging  Data                             Source program                 Debugging logouts

         

Three photo JPG files from three different digital cameras were used for RENPHOT debugging.  Headers of these files (browsed by ZTreeWin) are presented below. 

Note:  Debugging files were slightly modified to facilitate debugging of the date occurrence selection logic.  In real life some of the occurrences might be all zeros for whatever reason.  All occurrences that are non-zero are always identical (to the best of my knowledge, of course).  To distinguish between date occurrences during debugging I've incremented minutes by "1" in the second date-time occurrence and by "2" in the third.  This doesn't effect in any way the renaming logic, but permits to tell during debugging exactly what date-time occurrence has been chosen by the program.


          C:\DEBUG\OLYMP400.JPG – Olympus D400 photo JPG file head.

         

 FILE:  C:\DEBUG\OLYMP400.JPG
 ————————————————————————————————————————————————————————————————————————————
  00000000  ......Exif..II*........... .....................................
  00000040  ..............................(...........1...........2.........
  00000080  ..............i...............OLYMPUS DIGITAL CAMERA         .OL
  000000C0  YMPUS OPTICAL CO.,LTD.C900Z,D400Z...H.......H.......v872-72.....
  00000100  ....................1999:04:12 14:41:37...........*...........2.
  00000140  ..'.......d...........0210........:...........N.................
  00000180  ......b...........j...........r.................................
  000001C0  ..............z...|.......|.......}...............0100..........
  00000200  ..................................^.......................*...#.
  00000240  ......1999:04:12 14:42:37.1999:04:12 14:43:37...................
  00000280  ......P...............
  000002C0
  00000300             .......................N...........V...(.............
  00000340  ..........................H.......H.................R98.........
  00000380  0100....OLYMP...................................................
  000003C0  ......................"...........*...........6.......4...>.....
  00000400  .. ...z...........................................d.............
  00000440  ..SR872...[pictureInfo] Resolution=2 [Camera Info] Type=SR872...
  00000480  ......OLYMPUS DIGITAL CAMERA................O.........\"......\"
        
      
         
C:\DEBUG\OLYMP510.JPG – Olympus D510 photo JPG file head.

         

 FILE:  C:\DEBUG\OLYMP510.JPG
 ————————————————————————————————————————————————————————————————————————————
  00000000  ....8EExif..II*........... .....................................
  00000040  ..............................(...........1...........2.........
  00000080  ..............i...............OLYMPUS DIGITAL CAMERA         .OL
  000000C0  YMPUS OPTICAL CO.,LTD.C200Z,D510Z...H.......H.......v358u-76....
  00000100  ....................2002:02:06 20:10:29...........B...........J.
  00000140  .."...........'...................0210........R...........f.....
  00000180  ..................z.............................................
  000001C0  ..............................|...............}...............01
  00000200  00............................................v.................
  00000240  ......................#.......2002:02:06 20:11:29.2002:02:06 20:
  00000280  12:29.................$.......P...............
  000002C0
  00000300                                     .......................f.....
  00000340  ......n...(.......................................H.......H.....
  00000380  ............R98.........0100....OLYMP.............b.............
  000003C0  ..................................n...........v...........~.....
  00000400  ..............4........... .....................................
  00000440  ..........................................................d...d.
  00000480  ......d...............SX358...[pictureInfo] Resolution=1 [Camera
        
      
         
C:\DEBUG\SONYCBSH.JPG – Sony CyberShot photo JPG file head.

         

 FILE:  C:\DEBUG\SONYCBSH.JPG
 ————————————————————————————————————————————————————————————————————————————
  00000000  .....3Exif..II*........... .....................................
  00000040  ..............................(...........2.....................
  00000080  ..i...........d...                               .SONY..CYBERSHO
  000000C0  T.......H.......H.......2001:11:16 11:35:00.....................
  00000100  ......"...........'.......d...........0210......................
  00000140  ......................&.......................6.................
  00000180  ..............................>...........0100..................
  000001C0  ..........................F...................................-.
  00000200  ..........2001:11:16 11:36:00.2001:11:16 11:37:00...............
  00000240  ..........G.................R98.........0100....................
  00000280  ..........................................................(.....
  000002C0  ......2.......................................SONY..CYBERSHOT...
  00000300  ....H.......H.......2001:11:16 11:35:00........................(
  00000340  .....1#%.(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egc......./../cB8Bc
  00000380  ccccccccccccccccccccccccccccccccccccccccccccccccc...............
  000003C0  ..................................}........!1A..Qa."q.2....#B...
  00000400  R..$3br........%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz....
  00000440  ................................................................
  00000480  ..................................................w.......!1..AQ
        
      
         

All debugging files were copied from C:\DEBUG directory to C:\PBASIC (current directory for program debugging) for each debugging test case determined as the commented out line in the set of control parameters (see commented and highlighted in blue Parm$ lines in Get Control Parameters).  Required test case Parm$ line was uncommented and program was run in the PowerBASIC Interactive Development Environment (see PBE batch command).  Results were analysed and renamed JPG files along with DESCRIPT.ION were deleted from C:\PBASIC directory in preparation for the next test.  The only exception is the "Comment 7" test — renamed files and DESCRIPT.ION from the previous test were not deleted before this test in order to check file name incrementing that is used to resolve renaming conflicts.

Major part of testing was done for version 3.0 (this is reflected in renaming log titles).  Version 4.0 added time adjustment parameter, code for which is totally contained in two blocks that are separate from the rest of the program.  So two new tests were added for the time adjustment logic to the end of debugging logouts, while the rest of the tests were left as is from version 3.0 description.


         

 RENPHOT  Debugging  Logouts                       Source program               Debugging data
         

For each test case below (defined by uncommenting a Parm$ line) the corresponding renaming logout is shown along with generated DESCRIPT.ION file.  To facilitate renaming verification the date and time stamp from the file is printed with each renaming line.  Example below shows in colors how new name is generated from the date and time stamp.

         
   OLYMP400.JPG --> 04121442.JPG  1999:04:12 14:42:37
        
      
         

Note:  In certain situations actual file name might be different from the name generated out of date and time stamp (when actual name gets sequentially incremented to avoid name duplicity).  In case of time adjustment (last two tests that were added for version 4.0), file name is derived from the adjusted date and time (date and time in file renaming log always show what's recorded in the image file).

         

   Parm$=""
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  07:50
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121442.JPG  1999:04:12 14:42:37
   OLYMP510.JPG --> 02062011.JPG  2002:02:06 20:11:29
   SONYCBSH.JPG --> 11161136.JPG  2001:11:16 11:36:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121442.JPG Sun 04/12/1999 14:42
   02062011.JPG Wed 02/06/2002 20:11
   11161136.JPG Fri 11/16/2001 11:36
        
      
         
         

   Parm$="_Comment 1, etc."
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:02
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121442.JPG  1999:04:12 14:42:37
   OLYMP510.JPG --> 02062011.JPG  2002:02:06 20:11:29
   SONYCBSH.JPG --> 11161136.JPG  2001:11:16 11:36:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121442.JPG Sun 04/12/1999 14:42  Comment 1, etc.
   02062011.JPG Wed 02/06/2002 20:11  Comment 1, etc.
   11161136.JPG Fri 11/16/2001 11:36  Comment 1, etc.
        
      
         
         

   Parm$="/Comment 2, etc./:"
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:05
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121442.JPG  1999:04:12 14:42:37
   OLYMP510.JPG --> 02062011.JPG  2002:02:06 20:11:29
   SONYCBSH.JPG --> 11161136.JPG  2001:11:16 11:36:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121442.JPG Sun 04/12/1999 14:42  Comment 2, etc.
   02062011.JPG Wed 02/06/2002 20:11  Comment 2, etc.
   11161136.JPG Fri 11/16/2001 11:36  Comment 2, etc.
        
      
         
         

   Parm$="\Comment 3, etc.\:\1"
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:07
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121441.JPG  1999:04:12 14:41:37
   OLYMP510.JPG --> 02062010.JPG  2002:02:06 20:10:29
   SONYCBSH.JPG --> 11161135.JPG  2001:11:16 11:35:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121441.JPG Sun 04/12/1999 14:41  Comment 3, etc.
   02062010.JPG Wed 02/06/2002 20:10  Comment 3, etc.
   11161135.JPG Fri 11/16/2001 11:35  Comment 3, etc.
        
      
         
         

   Parm$="|Comment 4, etc.|:|3|04121443"
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:10
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121444.JPG  1999:04:12 14:43:37
   OLYMP510.JPG --> 02062012.JPG  2002:02:06 20:12:29
   SONYCBSH.JPG --> 11161137.JPG  2001:11:16 11:37:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121444.JPG Sun 04/12/1999 14:43  Comment 4, etc.
   02062012.JPG Wed 02/06/2002 20:12  Comment 4, etc.
   11161137.JPG Fri 11/16/2001 11:37  Comment 4, etc.
        
      
         
         

   Parm$="+Comment 5, etc.+:+3+04121443+CNYE-MO-DA"
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:12
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121444.JPG  1999:04:12 14:43:37
   OLYMP510.JPG --> 02062012.JPG  2002:02:06 20:12:29
   SONYCBSH.JPG --> 11161137.JPG  2001:11:16 11:37:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ——————————————————————————————————————————————————
   04121444.JPG Sun 1999-04-12 14:43  Comment 5, etc.
   02062012.JPG Wed 2002-02-06 20:12  Comment 5, etc.
   11161137.JPG Fri 2001-11-16 11:37  Comment 5, etc.
        
      
         
         

   Parm$="-Comment 6, etc.-:-3-04121443-DA.MO.CNYE-HR.UT.SZ"
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  08:18
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121444.JPG  1999:04:12 14:43:37
   OLYMP510.JPG --> 02062012.JPG  2002:02:06 20:12:29
   SONYCBSH.JPG --> 11161137.JPG  2001:11:16 11:37:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   —————————————————————————————————————————————————————
   04121444.JPG Sun 12.04.1999 14.43.37  Comment 6, etc.
   02062012.JPG Wed 06.02.2002 20.12.29  Comment 6, etc.
   11161137.JPG Fri 16.11.2001 11.37.00  Comment 6, etc.
        
      
         
         

   Parm$="*Comment 7, etc.*:*3*04121443
        
      
         

   Path:  C:\PBASIC
   —————————————————————————————————————————————————————
   02062012         .JPG  269,576 .... 22-05-02 18:48:26
   04121444         .JPG  192,540 .... 22-05-02 18:46:18
   11161137         .JPG  547,190 .... 22-05-02 18:49:50
   DESCRIPT         .ION      165 .a.. 24-05-02  8:18:26
   OLYMP400         .JPG  192,540 .a.. 22-05-02 18:46:18
   OLYMP510         .JPG  269,576 .a.. 22-05-02 18:48:26
   SONYCBSH         .JPG  547,190 .a.. 22-05-02 18:49:50
        
      
         

   RENPHOT(3.0)  Rename Digital Photo Image JPG Files  05-24-2002  19:02
   ---------------------------------------------------------------------
   OLYMP400.JPG --> 04121445.JPG  1999:04:12 14:43:37
   OLYMP510.JPG --> 02062013.JPG  2002:02:06 20:12:29
   SONYCBSH.JPG --> 11161138.JPG  2001:11:16 11:37:00
   ********
        
      
         

   Path:  C:\PBASIC
   —————————————————————————————————————————————————————
   02062012         .JPG  269,576 .... 22-05-02 18:48:26
   02062013         .JPG  269,576 .a.. 22-05-02 18:48:26
   04121444         .JPG  192,540 .... 22-05-02 18:46:18
   04121445         .JPG  192,540 .a.. 22-05-02 18:46:18
   11161137         .JPG  547,190 .... 22-05-02 18:49:50
   11161138         .JPG  547,190 .a.. 22-05-02 18:49:50
   DESCRIPT         .ION      321 .a.. 24-05-02 19:02:50
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   —————————————————————————————————————————————————————
   04121444.JPG Sun 12.04.1999 14.43.37  Comment 6, etc.
   02062012.JPG Wed 06.02.2002 20.12.29  Comment 6, etc.
   11161137.JPG Fri 16.11.2001 11.37.00  Comment 6, etc.
   04121445.JPG Sun 04/12/1999 14:43  Comment 7, etc.
   02062013.JPG Wed 02/06/2002 20:12  Comment 7, etc.
   11161138.JPG Fri 11/16/2001 11:37  Comment 7, etc.
        
      
         
         

   Parm$="/Comment 8, etc.//////+10:10"
        
      
         

   RENPHOT(4.0)  Rename Digital Photo Image JPG Files  10-18-2004  16:56
   ---------------------------------------------------------------------
   Note:  Time of each picture will be adjusted by the value of "+10:10"
   OLYMP400.JPG --> 04130052.JPG  1999:04:12 14:42:37
   OLYMP510.JPG --> 02070621.JPG  2002:02:06 20:11:29
   SONYCBSH.JPG --> 11162146.JPG  2001:11:16 11:36:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   --------------------------------------------------
   04130052.JPG Mon 04/13/1999 00:52  Comment 8, etc.
   02070621.JPG Thu 02/07/2002 06:21  Comment 8, etc.
   11162146.JPG Fri 11/16/2001 21:46  Comment 8, etc.
        
      
         
         

   Parm$="/Comment 9, etc.//////-01:01"
        
      
         

   RENPHOT(4.0)  Rename Digital Photo Image JPG Files  10-18-2004  17:04
   ---------------------------------------------------------------------
   Note:  Time of each picture will be adjusted by the value of "-01:01"
   OLYMP400.JPG --> 04121341.JPG  1999:04:12 14:42:37
   OLYMP510.JPG --> 02061910.JPG  2002:02:06 20:11:29
   SONYCBSH.JPG --> 11161035.JPG  2001:11:16 11:36:00
   ********
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   --------------------------------------------------
   04121341.JPG Sun 04/12/1999 13:41  Comment 9, etc.
   02061910.JPG Wed 02/06/2002 19:10  Comment 9, etc.
   11161035.JPG Fri 11/16/2001 10:35  Comment 9, etc.
        
      

         

View [and save] RENPHOT.BAS text       Download RENPHOT4.EXE file
(Use [Back] button or [Alt]+[CL] to return here from the viewed text)
To make RENPHOT.BAS source text compilable
change globally of "&lt;" into "<" signs and "&amp;" into "&" signs.
Copyright © 1999–2004 by
Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text top