PhotoApps - Contents


Part_0 Introduction & Overview of PhotoApps utilities useful to any Linux user
- Many applications based on bash shell scripts & command line utilities
- Run these apps with test/demo files provided, then run with your files.
- We teach Linux fundamentals as well as the Vancouver Utilities
- files & directories, bits & bytes, ASCII coding, hexadecimal, etc
- Unix/Linux command line utilities (ls,cd,cat,more,head,vi/vim,etc)
- Great training just by studying documentation on the website
- Even better if you can download/install Vancouver Utilities
- Or a userid/password guest login maybe available to allow you
  to test/demo applications without having to download/install

Part_1 renameIMG2 - Insert Date_Time prefixes on digital camera photos
- extract the Date/Times from digital camera photos & rename photos by
  inserting the Date_Time_ prefixes on existing camera assigned filenames
- uses 'EXIFTOOL' utility free download from 'exiftool.org'
- digital cameras assigned names such as DSCF0001,DSCF0002,etc whenever the
  camera memory was dumped to computer & cleared for next batch of photos.
- A problem if you want to reorganize & combine old photos into new albums,
  because filenames were duplicated each time you dumped your camera photos
- You probably allowed for this by setting up a date/time stamped sub-dirs
  & perhaps within a super-directory for the year.
- I used renameIMG2 to insert Date_Time_ prefixes into my 23,000 photos (60GB)
  collected over 20 years in 400 subdirs (dated as yyyymmdd when camera dumped
- You can demo renameIMG2 with a few sample photos provided either on your
  machine if you have Vancouver Utilities downloaded/installed, OR if you
  have one of the UV Software website userid/password logins.

Part_2 DTstamp1,2,3,4 - Annotate photos with filenames & date/times
- overlays photos with filenames & date/times on bottom edge of all photos
  in all subdirs of all years, assumes input from renameIMG2 above
- DTstamp1,DTstamp2,DTstamp3 scripts provided to annotate filenames/datetimes
  for 1 photo, all photos in 1 subdir, or all photos in all superdirs/subdirs
- uses 'annotate' function of ImageMagick free download from 'imagemagick.org'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

PhotoApps PhotoApps Contents Continued

Part 3 FaceID

FaceID scripts (FaceId1,2,3,4) are intended to Identify Faces for 1 photo, all in a subdir, all subdirs in a superdir, or all subdirs in all superdirs. using photos of known people to create filename filename lists of input photos followed by the filenames of the known people recognized.

We can then use the photo filename/people lists to copy the photo files, renaming the files to include the person initials, For example:

For an input photo named 'yyyymmdd_HHMMSS_dscf0001.jpg, the output file might be named 'yyyymmdd_HHMMSS_OtJtMc.jpg', where 'OtJtMc' are intials for Owen Townsend, Jill Townsend,& Mia Cameron.

This Allows you to select photos including known persons using command line tools (such as 'ls'), without having to view the photos (a very slow process).

Part3 FaceId is not yet available as of Feb 2022. We are still evaluating which 3rd party software tool to use. I am investigating the 'face_recognition' package by Adam Geitgey.


See: https://github.com/ageitgey/face_recognition

OR: https://face-recognition.readthedocs.io/en/latest/readme.html#features

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_0. Overview of PhotoApps - General Purpose Applications

PhotoApps - Apps using shell scripts & Linux CLI commands

PhotoApps documents several applications based on bash shell scripts & Linux Command Line Utilities supplemented with a few uvcopy programs when shell scripts insufficient.

You can run these apps with test/demo files provided, & then run with your files. PhotoApps is a great way for Linux newbies to self-educate on scripts & CLI commands.

We teach Linux fundamentals - files & directories, bits & bytes, Unix/Linux Command Line Utilities (ls,cd,cat,more,head,vi/vim,etc) Great training just by studying documentation on the website. Even better if you can download/install Vancouver Utilities. Or a userid/password guest login maybe available to allow you to test/demo applications without having to download/install

Books - CLI Tools, shell scripts, vi/vim, C programming

  1. Learning the Bash Shell - Cameron Needham - O'Reilly Press
  2. Bash Pocket Reference - Arnold Robbins - O'Reilly
  3. Bash Scripting - Jason Cameron
  4. The Linux Command Line - William Shotts
  5. Learning the vi & vim editor - Arnolds & Lamb - O'Reilly press
  6. The C Programming Language - Kernighan & Ritchie
  7. C Reference Manual - Harbison & Steele

    Internet Tutorials


 https://www.ubuntu.com/tutorials/command-line-for-beginners#1-overvie
 ========================================================================

 https://guru99.com/unix-linux-tutorial.html
 ============================================

And you can find a lot more online tutorials by googling with keywords such as: "Unix Linux command line utility tutorials".

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_1. renameIMGs - Insert Date_Time prefixes on digital photos

PhotoApps Part 1 - Contents


1A1. Overview of project to insert Date_Time prefixes on filenames of photos from
digital cameras (I had 20 years from various cameras & filenaming conventions).
1A2. Directories used to insert Date/Time prefixes

1B1. INPUT global dir 'photosA' from cameras

1B2. Interim Working dir 'photosB' to insert date/time prefixes
EXIFINFO - Dates/Times extracted by EXIFTOOL
 RENAME scripts - created by renameIMG2 procedures

1B3. OUTPUT dir 'photosC' with Date/Time prefixes on filenames, stored
within directories for the original year & date camera dumped.

1B4. Understanding differences photosA, photosB, photosC
renameIMG2 operates within the photosB superdir to copy/rename
all photos in all subdirs for any 1 year (repeat for each year).
renameIMG2 superscript calls renameIMG1, which calls sub-scripts
renameLNX, renameL2, exxifinfo, makeIMGrenames, then execute the
scripts created by uvmakeIMGrenames to copy/rename inserting Date/Times

1C1. renameIMG2 Procedures to prefix photos with dates/times
Procedures I used to insert Date/Time prefixes in 20 years of photos

1C2. Procedures (continued) to copy/rename 20 years of legacy photos.
See test/demo procedures following (demo you can run)

1D1. Login to Run renameIMG2 on Test/Demo files provided
On-Line with UV Software guest login
Or Off-Line if you have Vancouver Utilities installed on your machine

1D2. Preparation to Run renameIMG2 using Test/Demo files provided
Initialize testphotos/photosA,B,C,D files for renameIMG2 Demo
1D3. copy photosA/* sample photos to photosB/... Working dir for test/demo
tree diagram of photosB Working Dir - BEFORE renameIMG2

1E1. Execute renameIMG2 Demo with Test files provided
1E2. Abbreviated Instructions for other subdirs (vs 1st above)
1E3. tree diagram of photosB Working Dir - AFTER renameIMG2

1E4. CONTENTs of exifinfo/... directory/files (outputs of exiftool)
ImageMagick stores EXIF info for all photos (from each photo subdir)
into 1 file in the exifinfo/... directory.
We suggest using 'head' to see the 1st few records in each file.
'head' adds a title with filename to compensate for ImageMagick convert NOT
inserting #comments with filename (as makeIMGrenames for renames/scripts).

1E5. CONTENTs of renames/scripts created by makeIMGrenames.
renames/... directory where makeIMGrenames stores the scripts that
copy/rename photos while inserting date/time prefixes.

1E6. copy photosB/yyyyDT/... to photosC/yyyy/... (drop DT suffix)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

PhotoApps Part 1 - Contents (continued)


1F0. scripts used to rename photos inserting Date/Time prefixes.
 renameIMG2 - super-script to insert Date/Time prefixes on photo filenames
            - calls renameIMG1 to rename photos for any 1 year of photo history
 renameIMG1 - rename photos in each subdir (yyyymmdd) in current year (yyyy)
            - calls sub-scripts renameLNX,renameL2,exfinfo,makeIMGrenames
 renameLNX  - delete any non-printable characters in photo filenames
 renameL2   - rename an entire directory of filenames to lower case
 exifinfo   - extract Date/Time info for all photos in a directory
            - using exiftool, free download from exiftool.org
 makeIMGrenames - make script to rename inserting Date/Time prefixes in filenames
                - calls 'uvmakeIMGrenames' to match current filename to exifinfo
 uvmakeIMGrenames - uvcopy job to lookup tables of filenames & exifinfo

We will list only 2 scripts 'renameIMG1' on page '1F1' & 'exifinfo' on '1F2'. but you can see them all on the website at the links given on page '1F0'.

 1F1. renameIMG1 - script to rename photos to original date_time sequence
      - copies all photo files from 1 directory to a 2nd directory
        renaming as yyyymmdd_hhmmss_original-filename
     - called by renameIMG2 to process all subdiirs within a superdir

1F2. exifinfo - script calling 'exiftool' (free download from exiftool.org)
This script listed since it is the most vital part of the renameIMG project
Please visit https://exiftool.org (most informative & meticulously documented)

1G1. Script Writing Tips
We hope newbies will learn good "Script Writing Habits" by studying these scripts.
We also list a simpler script 'allrm' to help you learn to write your own scripts./
See listed on page '1G1' or at https://uvsoftware.ca/uvadm/sf/util/allrm

1G2. Working Directory Tips
Designing your directory structures is an important part of script writing.
Setup a working directory for each project with sub-directories holding all
files, no files in working directory, address files thru 1 level of subdir.

We hope you will use these scripting & directory/file tips to develope your script writing skills. You might start by writing a script to copy all files from 1 directory to a 2nd directory (might call it 'allcopy' patterned after the 'allrm' script listed on the previous page).

See the 'allcopy' solution at: https://uvsoftware.ca/uvadm/sf/util/allcopy But don't look until you have written & tested your own solution. Then think about writing your own application - perhaps mass processing some of your own text files to achieve some desired outcome.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A1. renameIMGs - Insert Date_Time prefixes on digital photos

Insert Date_Time on digital camera photo filenames

This document is on the website at https://uvsoftware.ca/photoapps.htm#Part_1 & stored in $UV/doc/renameIMG.doc if you have Vancouver Utilities installed on your computer.

This document describes procedures to extract the Date/Times from digital camera photos & rename the photos by inserting the Date/Times as prefixes to the filenames assigned by digital cameras - for example: DSCF0001,DSCF0002,etc .

Old digital cameras re-assigned names such as DSCF0001,DSCF0002,etc whenever the camera memory was dumped to computer & memory cleared for the next batch of photos.

This is a problem if you want to reorganize & combine your old photos in new albums, because the filenames were duplicated each time you dumped your camera photos onto your computer. You probably allowed for this by setting up a date/time stamped sub-dirs & perhaps within a super-directory for the year.

I will describe the procedures I used when I inserted Date/Time prefixes into the names of my digital camera photos from years 2002-2021 (23,000 photos, 60 Gigabytes).

Later I will present a demo that you can run with a few photos if you have Vancouver Utilities installed or if you have access to 1 of my website logins/passwords.

samples of renamed photos

Here are links to a few samples of the renamed photos. Actually these are the outputs from Part_2 which Annotates the photos with filenames & date/times.

Scripts DTstamp1,DTstamp2,&DTstamp3 are provided to annotate filenames/datetimes for 1 photo, all photos in 1 subdir, or all photos in all superdirs/subdirs using the 'annotate' function of ImageMagick free download from 'imagemagick.org'


 https://uvsoftware.ca/photos/20020808_144407_dscf0001.jpg
 ===========================================================
  - my first digital camera (in 2002)

 https://uvsoftware.ca/photos/20020808_150303_dscf0002.jpg
 ===========================================================
  - me with 1st digital camera

 https://uvsoftware.ca/photos/20180506_084904_img_1655.jpg
 ===========================================================
  - me at finish line of the Vancouver BMO half marathon

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A2. renameIMGs - Insert Date_Time prefixes on digital photos

Directories used to insert Date/Time prefixes

First I will describe the Directory structures I used for my 20 year conversions:

photosA
  • Input directory 'photosA' of all my digital camera photos when I transferred
    them (via USB) from an old computer to a new computer for this project.
  • digital camera photos collected over 20 years 2002-2021 (23,000 & 60 GB)
  • Super-Dirs by year (2002,2003,2004,etc --> 2021)
  • Sub-Dirs yyyymmdd when camera dumped (20020131,20020214,etc--> 20021231)
  • filenames dscf0001,dscf0002,etc - duplicated when camera dumped/cleared.
photosB
  • Interim working directory 'photosB' used to perform the extraction
    of date/times & renaming all photos with date/time prefixes.
  • photosB is where we run 'renameIMG2' script to extract date/times & insert
    them as prefixes as photos are copied for each input year/subdirs/files
    to the output year/subdirs/files, output years with suffix 'DT'
  • For example 2002/subdirs/files copied/renamed to 2002DT/subdirs/files
  • After all years processed, we will copy photosB 'DT' directories to
    the photosC directory dropping off the 'DT' suffixes to retain the
    original year/subdirs/files names (yyyy/yyyymmdd/files).
photosC
  • Final Results in 'photosC' after inserting Date/Time prefixes
Note
  • I did not need to copy photosA (60 GB) from USB to disc (keep USB as backup)
  • I copied the USB to photosB on disc & performed the interim processing there
    before copying the outputs to photosC (dropping off the 'DT' suffixes)
  • Actually could have done all processing in just 1 global dir, but I had space
    and wanted the backup in case I found reasons to reprocess later

Please study the sample directory structures, illustrated on the next 3 pages, to help you understand the 'renameIMG' procedures.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B1. renameIMGs - Insert Date_Time prefixes on digital photos

INPUT global dir 'photosA' from cameras


 tree photosA
 ============
 photosA
 |-- 2002/                  <-- Input super-directories for each year 2002--->2022
 |   |-- 20020131/            - use camera dump-dates as subdir-names within year
 |   |   |-- dscf0001.jpg       subdir 20020131 for photos taken from 20020101 to 20020131
 |   |   |-- dscf0002.jpg   <-- NO Date_Times from old digital cameras
 |   |   |-- --etc---.jpg     - 8 character filenames + '.jpg' extension
 |   |   |-- dscf0099.jpg     - see next page OUTPUTs with yyyymmdd_HHMMSS_ prefixes -->
 |   |   `-- --etc---
 |   |-- 20020214/            - might have dumped to computer whenever desired
 |   |   |-- dscf0001.jpg       using dump-date for subdir-name (within current year)
 |   |   |-- dscf0002.jpg     - etc, photos taken between Feb 01 & Feb 14/2002
 |   |   |-- --etc---
 |   |   |-- dscf0099.jpg     - last photo taken before camera dump on Feb 14/2002
 |   |   `-- --etc---
 |   |  ---etc---           <-- subdirs/photos in subdirs named for date dumped to computer
 |   |-- 20021231             - subdir for last camera dump in 2002
 |   |
 |-- 2003/                  <-- super-dir for photos taken in 2003
 |   |-- 20030115/            - sub-dir for photos from 20030101 to 200300115
 |   |   |-- dscf0001.jpg
 |   |   |-- dscf0002.jpg
 |   |   |-- --etc--
   ---- etc 2004,2005,2006,2007.... up to 2019,2020,2021,2022
 |-- 2021/                  <-- super-dir for photos taken in 2021
 |   |-- 20210101/            - subdir for photos taken on New Year's day
 |   |   |-- dscf0001.jpg
 |   |   |-- dscf0002.jpg     - NO Date_Times from old digital cameras
 |   |   |-- dscf0003.jpg
 |   |   |-- --etc--
 |   |  etc... for 2021/Feb,Mar...etc...Dec
 |   |-- 20211225/           <-- subdir for photos taken on Christmas day 2021
 |   |   |-- dscf0001.jpg
 |   |   |-- dscf0002.jpg
 |   |   |-- --etc--
 |   |   |-- dscf0099.jpg    <-- last photo taken in 2021 (on Christmas day)
Note
  • Compare above the INPUT directory structure in global dir 'photosA'
    to the desired OUTPUT directory structure in global dir 'photosC'
  • Understanding the date/time extract/rename is performed in 'photosB'
    before the yearDT-superdirs/datesubdirs/files are copied back 'photosC'
    to retain the original year/date/filenames (yyyy/yyyymmdd/filenames)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B2. renameIMGs - Insert Date_Time prefixes on digital photos

Interim Working dir 'photosB' to insert date/time prefixes


 tree photosB
 ============
 photosB                 <----- for all output superdirs(years)/subdirs(datesdumped)/files(date_times)
 |-- 2002DT/                <-- Input super-dirs for each year 2002--->2022
 |   |-- 20020131/            - use camera dump-dates as subdir-names within year
 |   |   |-- 20020101_184106_dscf0001.jpg   <-- Date/Time prefixes inserted
 |   |   |-- 20020101_184233_dscf0002.jpg     - photos taken on Jan 01/2002
 |   |   |------ etc photos taken from Jan 01/2002 to Jan 31/2002 ------
 |   |   |-- 20020131_194459_dscf0099.jpg     - last photo taken on Jan 31/2002
 |   |   `-- --etc---
 |   |-- 20020214/            - might have dumped to computer whenever desired
 |   |   |-- 20020201_102509_dscf0001.jpg     - photo taken on Feb 01/2002
 |   |   |-- 20020202_102833_dscf0002.jpg     - photo taken on Feb 01/2002
 |   |   `-- --etc---
 |   |   |-- 20020214_203547_dscf0099.jpg     - last photo before dump on Feb 14/2002
 |   |   `-- --etc---
 |   |  ---etc--- subdirs/photos in subdirs named for date dumped to computer
 |   |-- 20021231             - subdir for last camera dump in 2002
 |   |
 |-- 2003DT/                <-- super-dir for photos taken in 2003
 |   |-- 20030115/            - sub-dir for photos from 20030101 to 200300115
 |   |   |-- 20030101_170129_dscf0001.jpg
 |   |   |-- 20030101_170541_dscf0002.jpg
 |   |   |-- --etc--
   ---- etc 2004,2005,2006,2007.... up to 2019,2020,2021,2022
 |-- 2021DT/                <-- super-dir for photos taken in 2021
 |   |-- 20210101/            - subdir for photos taken on New Year's day
 |   |   |-- 20210101_110322_dscf0001.jpg
 |   |   |-- 20210101_110551_dscf0002.jpg
 |   |   |-- --etc--
 |   |  etc... for 2021/Feb,Mar...etc...Dec
 |   |-- 20211225/           <-- subdir for photos taken on Christmas day 2021
 |   |   |-- 20211201_193020_dscf0001.jpg
 |   |   |-- 20211201_193215_dscf0002.jpg
 |   |   |-- --etc--
 |   |   |-- 20211225_224455_dscf0099.jpg  <-- last photo in 2021 (on Christmas day)

EXIFINFO - Dates/Times extracted by EXIFTOOL

 |-- exifinfo/                  <-- Date/Times extracted by exiftool
 |   |-- 2002_20020131.exif       - used by makeIMGrenames to create scripts
 |   |-- 2002_20020209.exif         to copy/rename photos inserting date_time prefixes
 |   |-- ---2003,2004-->2021      - EXIF files contain dates/times for all photos on dump date
 |   |-- 2021_20211225.if

RENAME scripts - created by renameIMG2 procedures

 |-- renames/                   <-- scripts created by $UV/sf/util/makeIMGrenames
 |   |--                            (script calls uvcopy $UV/pf/util/uvmakeIMGrenames)
 |   |-- 2002_20020131.rnm        - to copy/rename photos inserting date_time prefixes
 |   |-- 2002_20020209.rnm
 |   |-- ---2003,2004-->2021
 |   |-- 2021_20211225.rnm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B3. renameIMGs - Insert Date_Time prefixes on digital photos

OUTPUT dir 'photosC' with original yyyy/yyyymmdd dirnames


 tree photosC
 ============
 photosC                 <----- for all output superdirs(years)/subdirs(datesdumped)/files(date_times)
 |-- 2002/                  <-- Input super-dirs for each year 2002--->2022
 |   |-- 20020131/            - use camera dump-dates as subdir-names within year
 |   |   |-- 20020101_184106_dscf0001.jpg   <-- Date/Time prefixes inserted
 |   |   |-- 20020101_184233_dscf0002.jpg     - photos taken on Jan 01/2002
 |   |   |------ etc photos taken from Jan 01/2002 to Jan 31/2002 ------
 |   |   |-- 20020131_194459_dscf0099.jpg     - last photo taken on Jan 31/2002
 |   |   `-- --etc---
 |   |-- 20020214/            - might have dumped to computer whenever desired
 |   |   |-- 20020201_102509_dscf0001.jpg     - photo taken on Feb 01/2002
 |   |   |-- 20020202_102833_dscf0002.jpg     - photo taken on Feb 01/2002
 |   |   `-- --etc---
 |   |   |-- 20020214_203547_dscf0099.jpg     - last photo before dump on Feb 14/2002
 |   |   `-- --etc---
 |   |  ---etc--- subdirs/photos in subdirs named for date dumped to computer
 |   |-- 20021231             - subdir for last camera dump in 2002
 |   |
 |-- 2003/                  <-- super-dir for photos taken in 2003
 |   |-- 20030115/            - sub-dir for photos from 20030101 to 200300115
 |   |   |-- 20030101_170129_dscf0001.jpg
 |   |   |-- 20030101_170541_dscf0002.jpg
 |   |   |-- --etc--
   ---- etc 2004,2005,2006,2007.... up to 2019,2020,2021,2022
 |-- 2021/                  <-- super-dir for photos taken in 2021
 |   |-- 20210101/            - subdir for photos taken on New Year's day
 |   |   |-- 20210101_110322_dscf0001.jpg
 |   |   |-- 20210101_110551_dscf0002.jpg
 |   |   |-- --etc--
 |   |  etc... for 2021/Feb,Mar...etc...Dec
 |   |-- 20211225/           <-- subdir for photos taken on Christmas day 2021
 |   |   |-- 20211201_193020_dscf0001.jpg
 |   |   |-- 20211201_193215_dscf0002.jpg
 |   |   |-- --etc--
 |   |   |-- dscf0099.jpg    <-- last photo taken in 2021 (on Christmas day)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B4. renameIMGs - Insert Date_Time prefixes on digital photos

Understanding differences photosA, photosB, photosC

photosA
  • Input digital camera photo collection (in my case 20 years 2002-2021)
    transferred (via USB) from old computer to a new computer for this project.
  • Super-Dirs by year (2002,2003,2004,etc --> 2021)
  • Sub-Dirs yyyymmdd when camera dumped (20020131,20020214,etc--> 20021231)
  • filenames dscf0001,dscf0002,etc - duplicated when camera dumped/cleared.
photosB
  • Interim working directory used to perform the extraction
    of date/times & renaming all photos with date/time prefixes.
  • photosB is where we run 'renameIMG2' script to extract date/times & insert
    them as prefixes as photos are copied for each input year/subdirs/files
    to the output year/subdirs/files, output years with suffix 'DT'
photosC
  • Final Results copied from photosB droping the 'DT' suffixes from years
    to retain the original year/subdirs/files names (yyyy/yyyymmdd/files).

'renameIMG2' operates within the photosB superdir to copy/rename all photos in all subdirs for any 1 year (repeat for each year). renameIMG2 superscript calls renameIMG1, which calls sub-scripts renameLNX, renameL2, exxifinfo, makeIMGrenames, then execute the scripts created by makeIMGrenames to copy/rename inserting Date/Times


 'renameIMG2' expects:
 =====================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C1. renameIMGs - Insert Date_Time prefixes on digital photos

renameIMG2 Procedures to prefix photos with dates/times

These procedures apply to the directory structures described above, that illustrate 20 years of photos stored in directories by year, subdirs within year whenever camera was dumped & cleared for next batch.

Folowing these general procedures, I will present a demo that you can execute on only a few sample photos provided in $UV/demo/testphotos/... You would need Vancouver Utilities installed on your machine, or you would need a userid/password for one of the UV Software website guest logins.

How I inserted Date/Time prefixes in 20 years of photos

Here are the procedures that I used to insert dates/times in my 20 years of photos (60 GB) that I had copied from an older computer to USB for processing on a new computer with more disc space. I setup the directories on a 2nd HDD (vs the OS SDD). I had created multiple file-sytems named /h21 /h22 /h23 /h24 /h5 /h26 /h27 /h28.


 #1. cd /h28       <-- change to a filesystem with sufficient space
     =======

 #2. mkdir photosA photosB photosC
     =============================
     - make the global directories as previously described

 #3a. cp -r /media/usb/photosA photosA  <-- copy from USB to photosA/... on disc
      ================================
 #3b. cp -r /media/usb/photosA photosB  <-- OR could copy direct to photosB/...
      ================================
      - could omit photosA on disc (since backup on USB) & do processing in photosB
      - change above as required if you stored on USB as zip or tar files

 #4. cp -r photosA/* photosB/
     ========================
     - omit this is you copied usb direct to photosB (#3b above)

 #5. cd photosB    <-- change into photosB for processing
     ==========

 #6. clean-up old photo directories
     ==============================

Remove any unwanted files from your photo subdirs before executing renameIMG2, such as thumbs.db, thumbnail.info, pspbrswe.jbf, etc. These are temporary files created by verious photo viewing software.

Note that exiftool will get the dates/times for videos as well as .jpg's (.mov, .avi, .mp4, etc)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C2. renameIMGs - Insert Date_Time prefixes on digital photos

Procedures (continued) to insert Date/Times in 20 years of photos


 #6. mkdir 2002DT 2003DT 2004DT ... 2021DT  <-- could make output superdirs, but no need
     =====================================
      - unnecessary because renameIMG2 makes output superdirs/subdirs as required
      - better not to make ahead of time, helps track which superdirs yet to be processed

 #7a. renameIMG2 2002 2002DT  <-- rename photos from 2002/subdirs/files to 2002DT/.../...
      ======================
 #7b. renameIMG2 2003 2003DT  <-- rename photos from 2003/subdirs/files to 2003DT/.../...
      ======================
        ----- etc -----
 #7t. renameIMG2 2021 2021DT  <-- rename photos from 2021/subdirs/files to 2021DT/.../...
      ======================

 #8. cd ..   <-- change above global dirs photosA,photosB,photosC
     =====

 #9. cp -r photosB/*DT photosC  <-- copy all ouput superdirs from photosB/... to photosC/...
     =========================

 #9a. mv photosB/*DT photosC    <-- OR move superdirs from photosB/... to photosC/...
      ======================        if you want to retain in the processing directory

 #10. rename-X photosC DT       <-- remove 'DT' suffixes from 2002DT 2003DT ... 2021DT
      ===================         - to use same names as original inputs in photosA
Note
  • see script 'rename-X' listed at uvsoftware.ca/scripts1.htm#1D3
  • just 1 of about 50 rename scripts that can save you a lot of manual keying
  • other scripts to add/remove prefixes, suffixes, quotes, spaces, etc
  • translate to UPPER or lower case, change any pattern anywhere to an alternate

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D1. renameIMGs - Insert Date_Time prefixes on digital photos

login to Run renameIMG2 on Test/Demo files provided

You can execute a renameIMG2 demo using a set of test dirs/files that are provided in $UV/demo/testphotos/... You would need Vancouver Utilities installed on your machine, or you would need a userid/password for one of the UV Software website guest logins.

Here are the instructions to login to a guest website & execute renameIMG2 on a small set of test files.

ON-Line Login to run renameIMG2


 #1. ssh uvsoftxx@uvsoftware.ca  <-- Online userid in range uvsoft00-uvsoft99
     ==========================
     --> passxx                  <-- enter your password at the prompt
                                   - assigned to you by UV Software

 #2.  cdm --> $HOME/uvsoftxx/demo
      ===
Note
  • 'cdm' is an alias to change to the demo directory (alias cdm='cd $HOME/demo')

Off-Line Alternative Login to run Demos


 #1. Login userxx   <-- Alternative Login ON YOUR OWN MACHINE
     ============       if YOU HAVE DOWNLOADED & INSTALLED VANCOUVER UTILITIEs
     --> passxx      <-- enter your password at the prompt
                       - assigned to you by YOURSELF or your SYSADM

 #2. mkdir demo     <-- make a demo directory (if not already present)
     ==========

 #3. cd demo   <-- change into your demo directory
     =======

 #4. cdm       <-- OR use handy alias cdm='cd $HOME/demo'
     ===         - works from anywhere on your system

 #5. pwd   <-- confirm you are in your $HOME/demo directrory
     ===   --> will show: /home/userxx/demo, userxx is your login (john,mary,etc)

 #6. cp -r $UV/demo/* .  <-- copy all $UV/demo subdirs/files to your homedir/demo/...
     ==================
Note1
  • Off-Line users need to copy demo/* files from $UV/demo/* to $HOME/demo/...
  • On-Line users with guest login/password do not need to (already setup)
    but you could re-copy from $UV/demo to your $HOME/demo if you make mistakes

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D2. Preparation to Run renameIMG2 on Test/Demo files provided

Initialize Test files for renameIMG2 Demo

These instructions assume EITHER - you have Vancouver Utilities installed on your machine, OR you have a UV Software guest userid/password & have used 'ssh' to login (as described on the previous page: ssh uvsoftxx@uvsoftware.ca


 #01.  cdm    <-- ensure you are in $HOME/uvsoftxx/demo
       ===      - online userids assigned by UV Software uvsoft01-uvsoft99
                - offline userids assigned by you or sysadm (VU installed on your machine)

 #02. cd testphotos   <-- change into Top-dir for Photo-Rename demo
      =============     - $HOME/demo/testphotos

 #03. l               <-- list Global dirs in $HOME/demo/testphotos/...
      ===
      drwxrwxr-x 4 userxx apps 4096 Jan 24 11:02 photosA  <-- Input of Legacy photos
      drwxrwxr-x 4 userxx apps 4096 Jan 24 11:02 photosB  <-- Working dir to copy/rename
      drwxrwxr-x 2 userxx apps 4096 Jan 24 11:02 photosC  <-- Output with date/time prefixes
      drwxrwxr-x 2 userxx apps 4096 Jan 24 11:02 photosD  <-- Annotate with filenames & date/times

 #04. rm -rf photosB/* photosC/* photosD/*  <-- remove outputs from any prior demos
      ====================================

 #05. tree   <-- create tree diagram of all dirs/subdirs/files below current dir
      ====     - only photosA input test files should be present at begin test/demo
 $HOME/userxx/testphotos/
 |-- photosA                 <------ Legacy photos (only a few for this demo)
 |   |-- 2002                  <---- superdir for each year
 |   |   |-- 20020809            <-- subdir whenever camera dumped to computer
 |   |   |   |-- dscf0001.jpg
 |   |   |   |-- dscf0002.jpg    <-- photo files within date-dumped subdir
 |   |   |   `-- dscf0003.jpg
 |   |   `-- 20020910
 |   |       |-- dscf0001.jpg    <-- camera reassigned duplicate names
 |   |       |-- dscf0002.jpg        after each camera dump & clear for next batch
 |   |       `-- dscf0003.jpg
 |   |-- 2003
 |   |   |-- 20030116
 |   |   |   |-- p1160051.jpg
 |   |   |   |-- p1160052.jpg   <-- various cameras assigned names differently
 |   |   |   `-- p1160053.jpg
 |   |   `-- 20030506
 |   |   |   |-- img_1050.jpg
 |   |   |   |-- img_1581.jpg
 |   |   `   `-- img_1655.jpg
 |   |-- 20xx                   <-- could be many more years of Legacy photos
 |   |                            - only 2002 & 2003 for this demo
 |-- photosB                    <-- Working dir (see subdirs created on next page)
 |-- photosC                    <-- Final outputs with Date/Time prefixes inserted
 `-- photosD                    <-- Annotate with filenames & date/times

 #06. cp -r $UV/demo/testphotos/photosA/* photosA/  <-- ONLY if photosA LOST
      ============================================
      - Recover photosA/* from $UV/demo/... if inadvertently lost from $HOME/demo/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1D3. Preparation to Run renameIMG2 on Test/Demo files provided

copy sample photos to Working dir for test/demo


 #07. cp -r photosA/* photosB  <-- copy test/demo photos to Working dir
      =======================    - only 3 subdirs of 3 files each in years 2002 & 2003
                                 - vs authors 20 years of 23,000 photos in 400 subdirs

 #08. cd photosB               <-- change into Working dir
      ==========                 - dirs/subdirs/files now same as photosA above

 #09. mkdir 2002DT 2003DT      <-- make output year superdirs
      ===================        - appending 'DT' to indicate Date/Times added
 #10. mkdir exifinfo           <-- for Dates/Times extracted by 'exiftool'
      ==============             - see exifinfo files later below
 #11. mkdir renames            <-- for copy/rename scripts created by makeIMGrenames
      =============
 #12. mkdir tmp                <-- temp directory for misc processing files
      =========
 #13. tree
      ====

photosB Working Dir - BEFORE renameIMG2

 $HOME/userxx/testphotos/photosB/ <-- dirs/files same as shown above in photosA/...
 |-- photosB
 |   |-- 2002                   <-- 2002 inputs from photosA
 |   |   |-- 20020809
 |   |   |   |-- dscf0001.jpg
 |   |   |   |-- dscf0002.jpg
 |   |   |   `-- dscf0003.jpg
 |   |   `-- 20020910
 |   |       |-- dscf0001.jpg
 |   |       |-- dscf0002.jpg
 |   |       `-- dscf0003.jpg
 |   |-- 2002DT                 <-- for 2002/... outputs with date/time prefixes
 |   |
 |   |-- 2003                   <-- 2003 inputs from photosA
 |   |   |-- 20030116
 |   |   |   |-- p1160051.jpg
 |   |   |   |-- p1160052.jpg   <-- various cameras assigned names differently
 |   |   |   `-- p1160053.jpg
 |   |   `-- 20030506
 |   |       |-- img_1050.jpg
 |   |       |-- img_1581.jpg
 |   |       `-- img_1655.jpg
 |   |-- 2003DT                 <-- for 2003/... outputs with date/time prefixes
 |   |
 |   |-- exifinfo               <-- for Dates/Times extracted by 'exiftool'
 |   |-- renames                <-- for copy/rename scripts created by makeIMGrenames
 |   `-- tmp
 |-- photosC                    <-- outputs 2002DT,2003DT,etc will be copied to photosC/...
 |   |                              (new photo collection with date/time prefixes)
 `-- photosD                    <-- follow-on optional project to annotate photos

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E1. renameIMGs - Insert Date_Time prefixes on digital photos

Execute renameIMG2 Demo with Test files provided


 #01. renameIMG2 2002 2002DT   <-- copy/rename all files with year/dumpdate subdirs
      ======================
 renameIMG2 - make script to rename photos to original date/time sequence
  - renames all files in all subdirs of a superdir while copying to 2nd superdir
  - calls renameIMG1 to process each sub-dir within SUPER-dir
  - if outdir not present, will make by appending 'DT' on indir
  - OK if present & empty, but ERROR if present & not empty
 Process Subdir #1 (of 2), 3 files, 2002/20020809 to 2002DT/20020809, reply 'c'=continue, 'g'=GoNonStop, 'q'=quit
 --> c   <-- reply c to continue
     ===
 Subdir# 1 of 2 - copying/renaming 2002/20020809 to 2002DT/20020809
 renameIMG1 - make script to rename photos to original date/time sequence
            - copy/rename 2002/20020809/filenames to 2002DT/20020809/yyyymmdd_hhmmss_filenames

Step#1 - rename indir files to Linux conventions & lower case rename files in subdir - deleting characters that must be escaped on Linux Remove characters that require escapes on Linux systems (usually none) rename all filenames in subdir to lower case

Step#2 - extract original date_times into exifinfo/2002/20020809.exif exifinfo - extract IMG info for makeIMGrenames exifinfo written to exifinfo/2002_20020809.exif

 Step#3 - create script to copy/rename 2002/20020809/... to 2002DT/20020809/...
 makeIMGrenames - make script to rename photos to original date/time sequence
  - copy/renaming indir/photonames to outdir/yyyymmdd_hhmmss_photonames
 makeIMGrenames - copy all files in 1 dir to a 2nd dir
 20220124:092406:makeIMGrenam: uvcopy ver=20201117 pf=/home1/uvadm/pf/util/uvmakeIMGrenames
 uvcopy LNX H64 license=20201117_99V_930630 site=UV_Software
 20220124:092406:makeIMGrenam: EOF fili02 rds=3 size=250: exifinfo/2002_20020809.exif
 20220124:092406:makeIMGrenam: EOF fili03 rds=3 size=39: tmp/infiles
 20220124:092406:makeIMGrenam: EOF fild01 size=4096: 2002/20020809
 20220124:092406:makeIMGrenam: EOF fild02 size=4096: 2002DT/20020809
 20220124:092406:makeIMGrenam: EOF filo02 wrts=5 size=418: renames/2002_20020809.rnm
 uvcopy uvmakeIMGrenames start 2022/01/24_11:09:24 end 11:09:24 elapsed 000_00_002
 Step#4 - execute created script to copy d1/... to 2002DT/20020809/...
 '2002/20020809/dscf0001.jpg' -> '2002DT/20020809/20020808_150303_dscf0001.jpg'
 '2002/20020809/dscf0002.jpg' -> '2002DT/20020809/20020809_124429_dscf0002.jpg'
 '2002/20020809/dscf0003.jpg' -> '2002DT/20020809/20020814_073829_dscf0003.jpg'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E2. renameIMGs - Insert Date_Time prefixes on digital photos

Abbreviated Instructions for other subdirs (vs first above)

 Process Subdir #2 (of 2), 3 files, 2002/20020910 to 2002DT/20020910, reply 'c'=continue, 'g'=GoNonStop, 'q'=quit c
 --> c   <-- reply c to continue
     ===
Note
  • will NOT show the complete log for the 2nd dumpdate in 2002
  • similar to 1st dumpdate shown above
 Subdir# 2 of 2 - copying/renaming 2002/20020910 to 2002DT/20020910
 renameIMG1 - make script to rename photos to original date/time sequence
 renameIMG1 - copy/rename 2002/20020910/photonames to 2002DT/20020910/yyyymmdd_hhmmss_photonames

Step#1 Step#2 <-- 2002 detail log for 2nd dumpdate similar to 1st shown above Step#3 Step#4


 #02. renameIMG2 2003 2003DT
      ======================
 renameIMG2 - make script to rename photos to original date/time sequence
  - renames all files in all subdirs of a superdir while copying to 2nd superdir
  - calls renameIMG1 to process each sub-dir within SUPER-dir
  - if outdir not present, will make by appending 'DT' on indir
  - OK if present & empty, but ERROR if present & not empty
 Process Subdir #1 (of 1), 3 files, 2003/20030101 to 2003DT/20030101, reply 'c'=continue, 'g'=GoNonStop, 'q'=quit c
 --> g   <-- reply g to process all subdirs Non-Stop (vs 'c' for 1 subdir at a time)
     ===
Note
  • will NOT show the complete log for the 2003 processing
  • similar to 2002 shown above (but only 1 dumpdate subdir in 2002)
 Subdir# 1 of 1 - copying/renaming 2003/20030101 to 2003DT/20030101
 renameIMG1 - make script to rename photos to original date/time sequence
 renameIMG1 - copy/rename 2003/20030101/photonames to 2003DT/20030101/yyyymmdd_hhmmss_photonames

Step#1 Step#2 <-- 2003 detail log similar to 2002 shown above Step#3 Step#4

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E3. renameIMGs - Insert Date_Time prefixes on digital photos

photosB Working Dir - AFTER renameIMG2


 #03. tree
      ====
 $HOME/demo/testphotos/photosB
 |-- photosB
 |   |-- 2002                                  <--- Input photos in yyyy superdir
 |   |   |-- 20020809                          <-- yyyymmdd subdirs for camera dumpdates
 |   |   |   |-- dscf0001.jpg
 |   |   |   |-- dscf0002.jpg                  <-- original photo names
 |   |   |   `-- dscf0003.jpg
 |   |   `-- 20020910
 |   |       |-- dscf0001.jpg                  <-- original photo names duplicated
 |   |       |-- dscf0002.jpg                       when camera dumped & cleared for new batch
 |   |       `-- dscf0003.jpg
 |   |-- 2002DT                                <--- Output photos in yyyyDT superdir
 |   |   |-- 20020809                          <-- same subdir names OK within yyyyDT superdirs
 |   |   |   |-- 20020808_150303_dscf0001.jpg
 |   |   |   |-- 20020809_124429_dscf0002.jpg  <-- Date/Time prefixes inserted on jpg files
 |   |   |   `-- 20020814_073829_dscf0003.jpg
 |   |   `-- 20020910
 |   |       |-- 20020905_043715_dscf0001.jpg
 |   |       |-- 20020905_110856_dscf0002.jpg
 |   |       |-- 20020907_064348_dscf0003.jpg
 |   |-- 2003                                  <-- 2nd year Input (of only 2 years for test)
 |   |   |-- 20030116                            - author had 20 years of Legacy photos
 |   |   |   |-- p1160051.jpg
 |   |   |   |-- p1160052.jpg
 |   |   |   `-- p1160053.jpg
 |   |   `-- 20030506
 |   |       |-- img_1050.jpg
 |   |       |-- img_1581.jpg
 |   |       `-- img_1655.jpg
 |   |-- 2003DT                                <-- 2nd year Output (ID by 'DT' suffix)
 |   |   |-- 20030116
 |   |   |   |-- 20050115_122920_p1160051.jpg
 |   |   |   |-- 20050116_131436_p1160052.jpg
 |   |   |   `-- 20050116_155634_p1160053.jpg
 |   |   `-- 20030506
 |   |       |-- 20161016_044043_img_1050.jpg
 |   |       |-- 20170507_085722_img_1581.jpg
 |   |       `-- 20180506_084904_img_1655.jpg
 |   |-- exifinfo                              <--- subdir for date/time extract by exiftool
 |   |   |-- 2002_20020809.exif
 |   |   |-- 2002_20020910.exif                <-- each file has date/times for all photos
 |   |   |-- 2003_20030116.exif                    within the camera dumpdate subdir
 |   |   `-- 2003_20030506.exif
 |   |-- renames                               <--- subdir for the copy/rename scripts
 |   |   |-- 2002_20020809.rnm
 |   |   |-- 2002_20020910.rnm                 <-- each file has cp instructions for all photos
 |   |   |-- 2003_20030116.rnm                     within the camera dumpdate subdir
 |   |   `-- 2003_20030506.rnm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E4. renameIMGs - Insert Date_Time prefixes on digital photos

CONTENTs of exifinfo/... directory/files

The above directory tree shows only the filenames of files in photosB/exifinfo/... To see the CONTENTS, you could use vi/cat/more/head/etc to display the records for a few output files to verify the date/Time prefixes inseerted as desired.

We suggest using the 'head' to see the 1st few records in each file. 'head' adds a title with filename to compensate for the fact that ImageMagick convert does NOT insert #comments with filename (as makeIMGrenames for the renames/scripts).


 #04. head exifinfo/*   <-- display 1st few records in files written by exiftool
      ===============
 head exifinfo/*
 ==> exifinfo/2002_20020809.exif <==
 dscf0003.jpg DT=20020814_073829 ISIZE=1600x1200 FSIZE=384 kB MODEL=FinePix4800 ZOOM
 dscf0002.jpg DT=20020809_124429 ISIZE=1280x960 FSIZE=312 kB MODEL=FinePix4800 ZOOM
 dscf0001.jpg DT=20020808_150303 ISIZE=1280x960 FSIZE=309 kB MODEL=FinePix4800 ZOOM
 ==> exifinfo/2002_20020910.exif <==
 dscf0003.jpg DT=20020907_064348 ISIZE=1600x1200 FSIZE=363 kB MODEL=FinePix4800 ZOOM
 dscf0002.jpg DT=20020905_110856 ISIZE=1600x1200 FSIZE=363 kB MODEL=FinePix4800 ZOOM
 dscf0001.jpg DT=20020905_043715 ISIZE=1600x1200 FSIZE=368 kB MODEL=FinePix4800 ZOOM
 ==> exifinfo/2003_20030116.exif <==
 p1160052.jpg DT=20050116_131436 ISIZE=2272x1704 FSIZE=910 kB MODEL=u20D,S400D,u400D
 p1160053.jpg DT=20050116_155634 ISIZE=2272x1704 FSIZE=891 kB MODEL=u20D,S400D,u400D
 p1160051.jpg DT=20050115_122920 ISIZE=2272x1704 FSIZE=885 kB MODEL=u20D,S400D,u400D
 ==> exifinfo/2003_20030506.exif <==
 img_1581.jpg DT=20170507_085722 ISIZE=5152x3864 FSIZE=5.9 MB MODEL=Canon PowerShot ELPH 160
 img_1655.jpg DT=20180506_084904 ISIZE=1571x1571 FSIZE=620 kB MODEL=Canon PowerShot ELPH 360 HS
 img_1050.jpg DT=20161016_044043 ISIZE=5152x3864 FSIZE=5.3 MB MODEL=Canon PowerShot ELPH 160

Alternative ways to display record contents

Note
  • You can try these alternative commands (NO output records shown here)

 #04a. vi exifinfo/*      <-- view contents of exifinfo/... files
       =============        - enter ':n' for next file

 #04b. more exifinfo/*    <-- or use 'more' for high volume files
       ==============

 #04c. cat exifinfo/*     <-- or use 'cat' for low volume files
       ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E5. renameIMGs - Insert Date_Time prefixes on digital photos

CONTENTs of renames/scripts


 #05. head renames/*   <-- display 1st few records in files written by makeIMGrenames
      ==============
 head renames/*
 ==> renames/2002_20020809.rnm <==
 # renames/2002_20020809.rnm - script to copy/rename files from 2002/20020809 to 2002DT/20020809
 # - run on 2022/02/13_10:57:38 by userxx on uvsoft2 at UV_Software
 cp -v 2002/20020809/dscf0001.jpg        2002DT/20020809/20020808_150303_dscf0001.jpg
 cp -v 2002/20020809/dscf0002.jpg        2002DT/20020809/20020809_124429_dscf0002.jpg
 cp -v 2002/20020809/dscf0003.jpg        2002DT/20020809/20020814_073829_dscf0003.jpg
 ==> renames/2002_20020910.rnm <==
 # renames/2002_20020910.rnm - script to copy/rename files from 2002/20020910 to 2002DT/20020910
 # - run on 2022/02/13_10:57:52 by userxx on uvsoft2 at UV_Software
 cp -v 2002/20020910/dscf0001.jpg        2002DT/20020910/20020905_043715_dscf0001.jpg
 cp -v 2002/20020910/dscf0002.jpg        2002DT/20020910/20020905_110856_dscf0002.jpg
 cp -v 2002/20020910/dscf0003.jpg        2002DT/20020910/20020907_064348_dscf0003.jpg
 ==> renames/2003_20030116.rnm <==
 # renames/2003_20030116.rnm - script to copy/rename files from 2003/20030116 to 2003DT/20030116
 # - run on 2022/02/13_10:59:04 by userxx on uvsoft2 at UV_Software
 cp -v 2003/20030116/p1160051.jpg        2003DT/20030116/20050115_122920_p1160051.jpg
 cp -v 2003/20030116/p1160052.jpg        2003DT/20030116/20050116_131436_p1160052.jpg
 cp -v 2003/20030116/p1160053.jpg        2003DT/20030116/20050116_155634_p1160053.jpg
 ==> renames/2003_20030506.rnm <==
 # renames/2003_20030506.rnm - script to copy/rename files from 2003/20030506 to 2003DT/20030506
 # - run on 2022/02/13_10:59:07 by userxx on uvsoft2 at UV_Software
 cp -v 2003/20030506/img_1050.jpg        2003DT/20030506/20161016_044043_img_1050.jpg
 cp -v 2003/20030506/img_1581.jpg        2003DT/20030506/20170507_085722_img_1581.jpg
 cp -v 2003/20030506/img_1655.jpg        2003DT/20030506/20180506_084904_img_1655.jpg

Alternative ways to display record contents

Note
  • You can try these alternative commands (NO output records shown here)

 #05a. vi renames/*      <-- view contents of renames/... files
       =============        - enter ':n' for next file

 #05b. more renames/*    <-- or use 'more' for high volume files
       ==============

 #05c. cat renames/*     <-- or use 'cat' for low volume files
       =============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1E6. renameIMGs - Insert Date_Time prefixes on digital photos

copy photosB/yyyyDT/... to photosC/yyyy/... (drop DT suffix)


 #06. cd $HOME/demo/testphotos          <-- change above global dirs
      ========================

 #07. cp -r photosB/2002DT photosC/2002  <-- copy photosB/yyyyDT/... to phtosC/yyyy/...
      =================================      dropping 'DT' suffix to retain orihginal years

 #08. cp -r photosB/2003DT photosC/2003  <-- only 2 years for ths demo
      =================================      (vs 20 for author)

 #09. tree photosC                       <-- show Final results in photosC
      ============
 tree photosC
 photosC
 |-- 2002
 |   |-- 20020809
 |   |   |-- 20020808_150303_dscf0001.jpg
 |   |   |-- 20020809_124429_dscf0002.jpg
 |   |   `-- 20020814_073829_dscf0003.jpg
 |   `-- 20020910
 |       |-- 20020905_043715_dscf0001.jpg
 |       |-- 20020905_110856_dscf0002.jpg
 |       `-- 20020907_064348_dscf0003.jpg
 `-- 2003
     |-- 20030116
     |   |-- 20050115_122920_p1160051.jpg
     |   |-- 20050116_131436_p1160052.jpg
     |   `-- 20050116_155634_p1160053.jpg
     `-- 20030506
         |-- 20161016_044043_img_1050.jpg
         |-- 20170507_085722_img_1581.jpg
         `-- 20180506_084904_img_1655.jpg
Note
  • We have dropped the 'DT' suffixes on 2002DT, 2003DT, etc to restore
    the original directory names (2002,2003,etc) used historically.
  • But our new filenames in 2002,2003,etc now have Date_Time_ prefixes.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F0. renameIMGs - Insert Date_Time prefixes on digital photos

scripts used to rename photos inserting Date/Times

We will list only 2 scripts 'renameIMG1' on page '1E2' & 'exifinfo' on '1E3'. but you can see them all on the website at the following links:


 https://uvsoftware.ca/uvadm/sf/util/renameIMG2
 ================================================
 - super-script to rename photos to original date_time sequence
 - renames as yyyymmdd_hhmmss_original-filename
 - renames all files in all sub-dirs in a super-dir (for each year)
   while creating a 2nd superdir with multiple sub-dirs & multiple files
 - calls renameIMG1 to process each sub-dir within the superdir

 https://uvsoftware.ca/uvadm/sf/util/renameIMG1    <-- listed on page '1E2'
 ================================================
 - rename photos in each subdir (yyyymmdd) in a superdir (yyyy)
 - called by renameIMG2 to process all subdirs within a superdir
 - calls sub-scripts renameLNX,renameL2,exfinfo,makeIMGrenames

 https://uvsoftware.ca/uvadm/sf/util/renameLNX
 ===============================================
 - rename all files in directory to Linux filenaming conventions
 - Deleting characters in filenames that must be escaped on Linux
 - also removing any LowBit & HiBit characters
   that would make filenames unprintable

 https://uvsoftware.ca/uvadm/sf/util/renameL2
 ==============================================
 - rename an entire directory of filenames to lower case
 - same as original version 'renameL' with prompts disabled

 https://uvsoftware.ca/uvadm/sf/util/exifinfo      <-- listed on page '1E3'
 ==============================================
 - extract Date/Time info for all photos in a directory
 - using exiftool, great tool by Phil Harvey
 - writes a file with Date/Time info for all photos in subdir
 - file written to exifinfo directory named for the current subdir
 - 1 line for each photo, original photo filename on left side
 - uvmakeIMGrenmaes will find matches by original photo filename

 https://uvsoftware.ca/uvadm/sf/util/makeIMGrenames
 ====================================================
 - make script to rename photos to original date_time sequence
 - renames as yyyymmdd_hhmmss_originalfilename
 - calls uvcopy job 'uvmakeIMGrenames' to match current filenmae
   to Date/Time info written by 'exiftool' in the 'exifinfo' directory

 https://uvsoftware.ca/uvadm/pf/util/uvmakeIMGrenames
 ======================================================
 - uvmakeIMGrenames is a uvcopy job called by the 'makeIMGrenames' script
 - makes scripts to rename photos inserting Date/Time prefixes
 - renames as yyyymmdd_hhmmss_## '_##' appended if > 1 in same second

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F1. renameIMGs - Insert Date_Time prefixes on digital photos

 #!/bin/bash
 # renameIMG1 - script to rename photos to original date_time sequence
 #            - script stored at $UV/sf/util/renameIMG1 in Vancouver Utilities
 #            - copies all photo files from 1 directory to a 2nd directory
 #              renaming as yyyymmdd_hhmmss_original-filename
 #            - called by renameIMG2 to process all subdiirs within a superdir
 #            - by Owen Townsend, UV Software, Nov2021, updates Feb/2022
 #
 # renameIMG2 - Also see SUPER-SCRIPT to process all files in all sub-dirs in a super-dir
 #              while creating a 2nd super-dir with multiple sub-dirs & multiple files in each
 #            - calls renameIMG1 for each pair of subdirs within superdir
 #
 # Rename directories of photos with various filenames to date_time filename sequence
 # - to allow browsing & slideshows to display in date/time sequence
 # - compensates for cameras that did not date/time stamp & assigned duplicate filenames
 #
 echo "renameIMG1 - make script to rename photos to original date/time sequence"
 d1="$1"; d2="$2";
 if [[ -d "$d1" && -d "$d2" && -d "exifinfo" && -d "renames" ]]; then :
    else echo "usage: renameIMG1 indir outdir "
         echo "       ========================"
         echo " - must specify arg1=indir & arg2=outdir"
         echo " - arg1=$d1, arg2=$d2"
         echo " - requires subdir exifinfo/ of info files created by exiftool"
         echo " - requires subdir renames/  to write copy/rename scripts"
         echo " - see more at begin $UV/sf/util/makeIMGrenames script"
         echo " - or at begin $UV/pf/util/uvmakeIMGrenames uvcopy job"
         exit 1; fi
 #
 echo "renameIMG1 - copy/rename $d1/photonames to $d2/yyyymmdd_hhmmss_photonames"
 if [[ -d tmp ]]; then rm -f tmp/*; else mkdir tmp; fi
 echo " "
 echo "Step#1 - rename indir files to Linux conventions & lower case "
 renameLNX $d1     # rename to rmove any spaces/punctuations in filenames
 renameL2  $d1     # rename to lower case, renameL2 DISABLES prompt & relist
 #============
 echo " "
 echo "Step#2 - extract original date_times into exifinfo/$d1.exif "
 exifinfo $d1      # extract original date_times into exifinfo/$d1.exif
 #===========      # - 1 line for each photo, sample shown below:
 # dscf0001.jpg DT=2003:08:09 20:01:03 ISIZE=1600x1200 FSIZE=161KB MODEL=FinePix4800 ZOOM
 echo " "
 echo "Step#3 - create script to copy/rename $d1/... to $d2/... "
 makeIMGrenames $d1 $d2   # create copy/rename script
 #=====================   # - calls uvcopy job $UV/pf/util/uvmakeIMGrenames
 echo " "
 echo "Step#4 - execute created script to copy $d1/... to $d2/... "
 d1u=$(echo $d1 | tr '/' '_')
 bash renames/$d1u.rnm   # execute created script to copy $d1/* to $d2/...
 #====================   # - prefixing filenames with yyyymmdd_HHMMSS
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F2. renameIMGs - Insert Date_Time prefixes on digital photos

exifinfo - script to extract EXIF info from images

 # exifinfo - extract EXIF info for all photos in a directory
 #          - using exiftool, free download from exiftool.org
 #          - script by Owen Townsend, Feb/2022
 #
 # This script $UV/sf/util/exifinfo called by $UV/sf/util/renameIMG1
 # renameIMG1 - copies jpg files from 1 dir to 2nd dir, prefixing names with date_time
 #  - calls exifinfo to extract date/Time info for all photos in a directory (yyyymmdd)
 #  - then calls makeIMGrenames to create scripts to rename the photos with date/time prefixes
 #    yyyymmdd_hhmmss_OriginalCameraFilename (dscf0001.jpg, dscf0002.jpg, etc)
 #  - sample command & output for 3 photos in directory 'photodir'
 #
 # exifinfo photodir     <-- command format, sample output below
 # =================
 # DSCF0016.jpg DT=2003:09:07 20:01:03 ISIZE=1600x1200 FSIZE=161 kB  MODEL=FinePix4800 ZOOM
 # BMO.jpg      DT=2018:05:06 08:49:04 ISIZE=5184x3888 FSIZE=6.4 MB  MODEL=Canon PowerShot ELPH 360 HS
 # Oliver.jpg   DT=2019:08:30 16:25:27 ISIZE=2253x3006 FSIZE=1413 kB MODEL=iPhone 7
 #
 test -d exifinfo || mkdir exifinfo # mkdir ./exifinfo if not present (to store exifinfo/reports)
 dir="$1";
 if [[ ! -d  "$dir" ]]; then
    echo "usage: exifinfo directory"
    echo "       =================="
    echo "  - arg1 must be a directory of images jpg,mov,mp4,etc"
    exit 99; fi
 #
 # translate any '/' slashes in $dir to '_' underscores
 dirt=$(echo $dir | tr '/' '_')
 #
 echo "exifinfo - extract IMG info for makeIMGrenames "
 exiftool -q -f -p '$filename DT=$CreateDate ISIZE=$imagesize FSIZE=$filesize MODEL=$model' \
                -d %Y%m%d_%H%M%S $dir >exifinfo/$dirt.exif 2>exifinfo/$dirt.exif_ERRS
 #============================================================================================
 #
 echo "exifinfo written to exifinfo/$dirt.exif & any ERRORs to exifinfo/$dirt.exif_ERRS"
 # show only the ERROR file here to alert user (can later investigate both files)
 if [[ -s exinfo/$dirt.exif_ERRS ]]; then
    echo "---------------------- exifinfo/$dirt.exif_ERRS -----------------------------"
    more exifinfo/$dirt.exif_ERRS
    else rm -f exifinfo/$dirt.exif_ERRS
 fi
 exit 0
Note
  • Can see all scripts on the website (links on prior page '1E1')
  • 'exifinfo' is listed since it is the most vital part of the rename project
  • 'exiftool' is a free download from exiftool.org
  • Please visit https://exiftool.org (most informative & meticulously documented)
  • great support at https://exiftool.org/forum

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1F3. renameIMGs - Insert Date_Time prefixes on digital photos

exiftool - can test from Command Line (vs script)

Can test exiftool from command line - for 1 photo or all in directory i For example, assuming:

extract EXIF infor for all photos in directory


 exiftool -f -p '$filename $datetimeoriginal' 2002/20020809
 ==========================================================
  - extract EXIF info for all photos in directory
  - displays 1 line for each photo as follows:
    dscf0001.jpg 2003:09:07 20:01:03 ISIZE=1600x1200 FSIZE=161 kB  MODEL=FinePix4800 ZOOM
    dscf0002.jpg 2003:09:07 20:02:45 ISIZE=1600x1200 FSIZE=161 kB  MODEL=FinePix4800 ZOOM

extract EXIF info for any 1 photo


 exiftool -f -p '$filename $datetimeoriginal' 2002/20020809/dscf0001.jpg
 =======================================================================
  - extract EXIF info for 1 photo (vs all in directory)
  - display as follows:
    dscf0001.jpg 2003:09:07 20:01:03 ISIZE=1600x1200 FSIZE=161 kB  MODEL=FinePix4800 ZOOM

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G1. renameIMGs - Insert Date_Time prefixes on digital photos

We hope newbies will learn good "Script Writing Habits" by studying these scripts. Only 2 scripts (renameIMG1 on page '1E2' & 'exifinfo' on page '1E3'), listed here, but you can see all 7 on the website at links listed on page '1E1'.

Script Writing Tips

  1. 1st line should be --> #!/bin/bash <--

  2. 2nd line #comment with filename of script + description of what it does.

  3. Following #comments would include author, date written, dates updated, arguments required & command examaples

  4. Better if Command format & arguments required coded on "echo ..." lines - displayed when user does not enter correct command & arguments For example, Here is a short script illustrating "Script Writing Tips" (also listed at https://uvsoftware.ca/uvadm/sf/util/allrm). Please study & understand the comment #** ... ** notes on right side

 #!/bin/bash
 # allrm - script to remove all files from a directory
 #       - shell script stored $UV/sf/util/allrm
 #       - by Owen Townsend, UV Software, June 1993
 # Use if no of files greater than allowed by UNIX shell
 #  - if you get "arg list too long" (early versions of unix)
 #  - also provides audit trail with file-counts
 d1="$1";                       #** assign names to command line args **
 if [[ ! -d "$d1" ]]; then
    echo "usage: allrm directory"   #** help screen if args not spcfd **
    echo "       ==============="
    echo " - arg1 must be a directory"
    exit 1; fi
 #
 reply="x"                        #** prompt user & confirm reply y/n **
 until [[ "$reply" == "y" || "$reply" == "n" ]]
   do echo "Remove files from $d1 ? y/n"  #** until/do/done construct **
      read reply
   done
 if [[ "$reply" == "n" ]]; then           #** test operator reply y/n **
    echo "reply=n, job cancelled"; exit 99; fi
 #
 rmctr=0;
 for d1f1 in $d1/*              #** 'for' to process all files in dir **
   { f1=$(basename $d1f1)       #** isolate filenames from dirs/files **
     rm -f $d1/$f1              #** highlight vital commands in script**
     #============              #   by === underlining                **
     ((rmctr+=1))               #** count for progress report & totals**
     echo "#$rmctr file removed - $d1/$f1"        #** progress report **
   }
 echo " $rmctr ** Total Files Removed from $d1"    #** report results **
 exit

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1G2. renameIMGs - Insert Date_Time prefixes on digital photos

Working Directory Tips

  1. Setup a "Working Directory" for each project & logical part of a project. 'testphotos/' is our super working directory to test the photo rename scripts & 'testphotos/photosB/' is our principal Working Directory for the project.

  2. The working directory should contain only 'sub-directories' & no files. All files should be kept within sub-directories. The number of sub-dirs is usually less than a screen & you don't get lost in among the possibly hundreds of files in the sub-directories.

  3. Stay in the workingdir, do not change into the subdirs, address your files thru 1 level of subdir. Scripts will address their files within sub-dirs often reading/copying/modifying between multiple sub-dirs.

  4. Subdirs allow you to maintain the same filename for data & programs in the various stages of processing, conversion, backup, etc.

  5. Note that when all files are kept within subdirs, then any file appearing in the working dir is an error situation needing investigation.

  6. Keeping files in sub-dirs & staying in the working directory (1 level above) protects your files, even the infamous 'rm *' would do no harm at the working directory level, since all files are in subdirs.

  7. Setup a tmp/ subdir in your working dir to hold any temporary files which would clutter up your working dir. Many scripts will use the ./tmp dir (& setup if not present).

  8. Clean out the tmp/ subdir frequently to make it easy for you to review outputs of scripts that write their outputs there for you to inspect.

    Project for Linux Newbies

We hope you will use these scripting & directory/file tips to develope your script writing skills. You might start by writing a script to copy all files from 1 directory to a 2nd directory (might call it 'allcopy' patterned after the 'allrm' script listed on the previous page).

If you want to test for an empty output directory, see line 42 in https://uvsoftware.ca/uvadm/sf/util/renameIMG2 as follows:

 if [[ "$(ls -A $d2)" ]]; then echo "ERROR - outdir must be empty"; exit 92; fi;

See the 'allcopy' solution at: https://uvsoftware.ca/uvadm/sf/util/allcopy But don't look until you have written & tested your own solution.

Then think about writing your own application - perhaps mass processing some of your own text files to achieve some desired outcome.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_2. DTstamp - Annotate photos with filenames & date/times

'DTstamp' is a Follow-On Project to Annotate photos with Filename & Date/Times on bottom edge of all photos in all subdirs of all years. We will copy photosC/* date/time prefixed photos to photosD/... & run scripts to annotate photos using the 'annotate' function of ImageMagick (free download/install).

Part 2 - Contents


2A1. Overview of project to Annotate photos with filenames

2B0. Listings of scripts used to annotate photos for 1 at a time, all photos in
1 directory,& all photos in all directories within a super-directory.

2B1. Annotate filename on 1 photo at a time while copying to separate file

2B2. Annotate filenames on all photos in a directory while copying to 2nd directory
Our directory names were the dates when digital cameras were dumped yyyymmdd

2B3. Annotate filenames on all photos in all directories of a super-directory
Our SUPER-directories were the years holding the directories from the
 various camera dumps within each year.

2B4. Annotate filenames on all photos in all directories of all super-directories
for the 20 years of camera photos collected by Owen Townsend.
DTstamp4 called DTstamp3 for each year. The years were hard-coded in the
script, so DTstamp4 is not general purpose as are DTstamp1,2,3.

2C1. Login to run Demo Executions using Test files provided
You might also be able to run these scripts on test files provided if you have
a userid/password to 1 of UV Software's guest login accounts, Or if you have
downloaded/installed Vancouver Utilities on your machine.

2C2. Preparation to run Demo Executions using Test files provided
2C3. Login to run Demo Executions using Test files provided

2D1. Test Files to demo DTstamp1,2,3
2D2. Inputs to DTstamp1,2,3 from Part1 with date/time prefixes **
2D3. copy outputs of Part1 renameIMG2 for Part2 DTstamp1,2,3

2E0. Initialize test files for DTstamp1,2,3
2E1. Run DTstamp1 on test file provided & observe results.
2E2. Run DTstamp2 on all test files in a directory & observe results.
2E3. Run DTstamp3 on all test files in all sub-dirs of a super-dir

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A1. Overview of project to Annotate photos with filenames

Part 2 is a "Follow-On" project from Part 1, which inserted Date/Time prefixes on the filenames of photos from digital cameras, which often assigned duplicate names after camera dumps & memory clear.

Part 2 will "Annotate" photos with the photo Filename (including Date/Time prefix) on bottom edge of the photos using the 'annotate' function of 'ImageMagick' which is free to download/install. We have scripts (DTstamp1,DTstamp2,DTstamp3,DTstamp4) to Annotate 1 photo, all photos in a directory,& all photos in all sub-directories of a super-directory.

Script Listings of DTstamp1,2,3,4

The scripts are most conveneintly listed on the following pages (2B1,2B2,2B3,2B4). You can also see these scripts on the UV Software website at the following links:


 https://uvsoftware.ca/uvadm/sf/util/DTstamp1
 ==============================================
 - annotate filename on 1 photo

 https://uvsoftware.ca/uvadm/sf/util/DTstamp2
 ==============================================
 - annotate filenames on all photos in a directory
 - our directory names were the dates when digital cameras were dumped yyyymmdd

 https://uvsoftware.ca/uvadm/sf/util/DTstamp3
 ==============================================
 - annotate filenames on all photos in all directories of a super-directory
 - our super-directories were the years holding the directories from the
   various camera dumps within each year.

 https://uvsoftware.ca/uvadm/sf/util/DTstamp4
 ==============================================
 - annotate filenames on all photos in all directories of all super-directories
   for the 20 years of camera photos collected by Owen Townsend.
 - DTstamp4 called DTstamp3 for each year. The years were hard-coded in the
   script, so DTstamp4 is not general purpose as are DTstamp1,2,3.

Demo Executions using test files provided

You might also be able to run these scripts on test files provided if you have a userid/password to 1 of UV Software's guest login accounts, Or if you have downloaded/installed Vancouver Utilities on your machine. See Login details on page '3A1'.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B1. scripts to ANNOTATE filenames on photos

DTstamp1 - annotate filename on 1 photo at a time

 #!/bin/bash
 # DTstamp1 - annotate filename on 1 photo using Image Magick Convert
 #          - overlays date/time stamp on bottom edge of .jpg photos
 #          - by Owen Townsend, UV Software, Jan 2022, update Feb 2022
 #          - see alternate scripts to annotate all photos in directories
 #*DTstamp1 - processes dir1/1file to dir2/1file
 # DTstamp2 - processes dir1/ALL*FILEs to dir2/ALL*FILEs
 # DTstamp3 - processes dir1/ALL*SUBDIRs/all*files to dir2/ALL*SUBDIRs/ALL*FILEs
 # DTstamp4 - calls DTstamp3 to annotate .jpg photos with filenames & Date/Time stamps
 #            for all superdirs of photos by year (2002 - 2022)
 f1="$1"; f2="$2";
 if [[ -f "$f1" && -n "$f2" && "$f1" != "$f2" ]]; then :
    else echo "usage: DTstamp1 infile outfile"
         echo "       ======================="
         echo " - arg1 input filename must be a .jpg file"
         echo " - arg2 output filename must be specified & different dir or file"
         echo " "
         echo "Example: DTstamp1 2002/20020809/20020808_150303_dscf0001.jpg tmp/dscf0001.jpg"
         echo "         ===================================================================="
         exit 99; fi
 #
 # annotate DateTime only if different than Date_time prefix inserted by renameIMG2
 # - get EXIF DateTime using IM identify
 # - convert format to match filename prefix, "YYYY:MM:DD HH:MM:SS" to "YYYYMMDD_HHMMSS"
 # - if match: annotate only the filename, if nonmatch: annotate both DateTime & filename
 exifdt1=$(identify -format "%[EXIF:DateTime]" "$f1")
 exifdt2=$(echo "$exifdt1" | tr " " "_" | tr -d ":")
 f1dt=$(basename $f1)
 # f2dt=${f1dt%_*} # drop back to '_' ##<-- problem if '_'s in filename
 f2dt=$(echo $f1dt | cut -c1-15)      ##<-- cut after 15 chars yyyymmdd_HHMMSS
 #              # Converts: "yyyymmdd_hhmmss_img_1050.jpg" to "yyyymmdd_hhmmss"
 # calc pointsize = (PixelXDimenion  / 30) # exifXD=2272,exifPS=75; exifXD=5152,exifPS=171
 exifXD=$(identify -format "%[EXIF:PixelXDimension]" "$f1")
 exifPS=$((exifXD/30))
 #
 # echo "DEBUG1: f1=$f1, f2=$f2"
 # echo "DEBUG2: f2dt=$f2dt, exifdt2=$exifdt2, exifXD=$exifXD, exifPS=$exifPS"
 if [[ "$f2dt" != "$exifdt2" ]]; then
    convert $f1 -font Arial -pointsize "$exifPS" -fill yellow\
             -gravity SouthWest -annotate +40+250 %[exif:DateTimeOriginal]\
             -gravity SouthWest -annotate +40+050 '%f' $f2
 else
    convert $f1 -font Arial -pointsize "$exifPS" -fill yellow\
             -gravity SouthWest -annotate +40+050 '%f' $f2
 fi
 #===========================================================================
 echo "$f1 date-time stamped while copying to $f2"
 exit 0
Note
  • see page '2E1' for demo you can run with test files provided

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B2. DTstamp2 - annotate filenames on all photos in a directory

 #!/bin/bash
 # DTstamp2 - annotate filenames on ALL photos in 1 DIRECTORY using Image Magick Convert
 #          - overlays date/time stamp on bottom edge of .jpg photos
 #          - our directory names were the dates when digital cameras were dumped yyyymmdd
 #          - by Owen Townsend, UV Software, Jan 2022, update Feb 2022
 #          - batch script, date-time-stamps all photos while copying from dir1 to dir2
 #          - see alternate scripts to annotate all photos in directories
 # DTstamp1 - processes dir1/1file to dir2/1file
 #*DTstamp2 - processes dir1/ALL*FILEs to dir2/ALL*FILEs
 # DTstamp3 - processes dir1/ALL*SUBDIRs/all*files to dir2/ALL*SUBDIRs/ALL*FILEs
 # DTstamp4 - calls DTstamp3 to annotate .jpg photos with filenames & Date/Time stamps
 #            for all superdirs of photos by year (2002 - 2022)
 d1="$1"; d2="$2";
 if [[ -d "$d1" && -d "$d2" ]]; then :
    else echo "usage: DTstamp2 indir outdir"
         echo "       ====================="
         echo " - arg1 & arg2 must be directories"
         echo " "
         echo "Example: DTstamp2 20020809 20020809DTS"
         echo "         ============================="
         echo " - process all files from indir 20020809/... to outdir 20020809DTS/..."
         exit 99; fi
 #
 tsdj=0;  # init count of .jpg's
 tsdx=0;  # init count of non .jpg's
 tcvs=0;  # init count of convert errors
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 for d1f1 in $d1/*
   { f1=$(basename $d1f1)
     f2=$f1;              # $f2 same as $f1 but might clarify
     # convert/annotate only .jpg (or .JPG), else just copy
     if [[ ("$f1" == *.jpg) || ("$f1" == *.JPG) ]] ; then
        # annotate DateTime only if different than Date_time prefix inserted by renameIMG2
        # - get EXIF DateTime using IM identify
        # - convert format to match filename prefix, "YYYY:MM:DD HH:MM:SS" to "YYYYMMDD_HHMMSS"
        # - if match: annotate only the filename, if nonmatch: annotate both DateTime & filename
        exifdt1=$(identify -format "%[EXIF:DateTime]" "$d1/$f1")
        exifdt2=$(echo "$exifdt1" | tr " " "_" | tr -d ":")
        f1dt=$(basename $d1/$f1)
        # f2dt=${f1dt%_*} # drop back to '_' ##<-- problem if '_'s in filename
        f2dt=$(echo $f1dt | cut -c1-15)      ##<-- cut after 15 chars yyyymmdd_HHMMSS
        #              # Converts: "yyyymmdd_hhmmss_img_1050.jpg" to "yyyymmdd_hhmmss"
        # calc pointsize = (PixelXDimenion  / 30) # exifXD=2272,exifPS=75; exifXD=5152,exifPS=171
        exifXD=$(identify -format "%[EXIF:PixelXDimension]" "$d1/$f1")
        exifPS=$((exifXD/30))
        #
        # echo "DEBUG1: d1/s1/f1=$d1/$f1, d2/s2/f2=$d2/$f2"
        # echo "DEBUG2: f2dt=$f2dt, exifdt2=$exifdt2, exifXD=$exifXD, exifPS=$exifPS"
        if [[ "$f2dt" != "$exifdt2" ]]; then
           convert $d1/$f1 -font Arial -pointsize "$exifPS" -fill yellow\
                    -gravity SouthWest -annotate +40+250 %[exif:DateTimeOriginal]\
                    -gravity SouthWest -annotate +40+050 '%f' $d2/$f2
        else
           convert $d1/$f1 -font Arial -pointsize "$exifPS" -fill yellow\
                    -gravity SouthWest -annotate +40+050 '%f' $d2/$f2
        fi
        cvstat=$?                         # capture status returned by convert
        if ((cvstat)); then ((tcvs=+1))   # count errors
           echo "convert annotate ERROR# $tcvs for $d1/$f1";
        fi
        ((tsdj+=1))        # count .jpg's annotated
     else
       cp $d1/$f1 $d2/$f2  # copy non .jpg's copied unchanged
       ((tsdx+=1))         # count others (not .jpg's)
     fi
   }
 echo "$tsdj .jpg's date-time stamped from $d1/... to $d2/... "
 if ((tsdx)); then echo "$tsdx TOTAL non-jpgs copied unchanged to $d2/..."; fi
 if ((tcvs)); then echo "$tcvs convert annotate TOTAL ERRORs in $d1/..."; fi
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B3. DTstamp3 - annotate all photos in all subdirs within a super-dir

 #!/bin/bash
 # DTstamp3 - annotate filenames on all photos in ALL DIRECTORIES of a SUPER-DIRECTORY
 #          - overlays date/time stamp on bottom edge of .jpg photos
 #          - our super-dirs were the years holding the sub-dirs camera dumps during year
 #          - by Owen Townsend, UV Software, Jan 2022, update Feb 2022
 #          - batch script to annotate .jpg photos with filenames & Date/Time stamps
 #            while copying from dir1/*/* to dir2
 #          - uses ImageMagic convert annotate for filename & EXIF:DateTime
 #          - see alternate scripts as follows:
 # DTstamp1 - processes dir1/1file to dir2/1file
 # DTstamp2 - processes dir1/all*files to dir2/all*files
 #*DTstamp3 - processes dir1/all*subdirs/all*files to dir2/all*subdirs/all*files
 # DTstamp4 - calls DTstamp3 to annotate .jpg photos with filenames & Date/Time stamps
 #            for all superdirs of photos by year (2002 - 2022)
 #
 d1="$1"; d2="$2";
 if [[ -d "$d1" && -n "$d2" && "$d1" != "$d2" ]]; then :
    else echo "usage: DTstamp3 indir outdir"
         echo "       ====================="
         echo "       - arg1 (input superdir) must be a directory & not same as output superdir"
         echo "       - arg2 (output superdir) must be specified, will make if not present"
         echo "       - but if output superdir present, it must be empty"
         echo "       - will create subdirs in outdir named same as subdirs in indir"
         echo " "
         echo "Example: DTstamp3 2002 2002DTS"
         echo "         ====================="
         echo " - process all files from ALL subdirs in 2002/.../... to 2002DTS/.../..."
         exit 91; fi
 #
 # if outdir not present, will make by appending 'DTS' on indir
 # OK if present & empty, but ERROR if present & not empty
 if   [[ ! -d "$d2" ]]; then mkdir ${d1}DTS;
 elif [[ "$(ls -A $d2)" ]]; then echo "ERROR - outdir must be empty, exiting"; exit 92; fi;
 tsd=0; tsdj=0; tsdx=0; tcvs=0;
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 for d1s1 in $d1/*
   { ((tsd+=1));                   # count total subdirs processed dir1 to diir2
     tsd1j=0; tsd1x=0; tcvs1=0;    # clear acums jpgs & non-jpgs in current subdir
     s1=$(basename $d1s1); s2=$s1; # $s2 same as $s1, but might help clarify
     mkdir $d2/$s1                 # make output subdir within dir2
     for d1s1f1 in $d1/$s1/*
       { f1=$(basename $d1s1f1); f2=$f1; # $f2 same as $f1, but might help clarify
         # convert/annotate only .jpg (or .JPG), else just copy
         if [[ ("$f1" == *.jpg) || ("$f1" == *.JPG) ]] ; then
            # annotate DateTime only if different than Date_time prefix inserted by renameIMG2
            # - get EXIF DateTime using IM identify
            # - convert format to match filename prefix, "YYYY:MM:DD HH:MM:SS" to "YYYYMMDD_HHMMSS"
            # - if match: annotate only the filename, if nonmatch: annotate both DateTime & filename
            exifdt1=$(identify -format "%[EXIF:DateTime]" "$d1/$s1/$f1")
            exifdt2=$(echo "$exifdt1" | tr " " "_" | tr -d ":")
            f1dt=$(basename $d1/$s1/$f1)
            # f2dt=${f1dt%_*} # drop back to '_' ##<-- problem if '_'s in filename
            f2dt=$(echo $f1dt | cut -c1-15)      ##<-- cut after 15 chars yyyymmdd_HHMMSS
            #              # Converts: "yyyymmdd_hhmmss_img_1050.jpg" to "yyyymmdd_hhmmss"
            # calc pointsize = (PixelXDimenion  / 30) # exifXD=2272,exifPS=75; exifXD=5152,exifPS=171
            exifXD=$(identify -format "%[EXIF:PixelXDimension]" "$d1/$s1/$f1")
            exifPS=$((exifXD/30))
            #
            # echo "DEBUG1: d1/s1/f1=$d1/$s1/$f1, d2/s2/f2=$d2/$s2/$f2"
            # echo "DEBUG2: f2dt=$f2dt, exifdt2=$exifdt2, exifXD=$exifXD, exifPS=$exifPS"
            if [[ "$f2dt" != "$exifdt2" ]]; then
               convert $d1/$s1/$f1 -font Arial -pointsize "$exifPS" -fill yellow\
                        -gravity SouthWest -annotate +40+250 %[exif:DateTimeOriginal]\
                        -gravity SouthWest -annotate +40+050 '%f' $d2/$s2/$f2
            else
               convert $d1/$s1/$f1 -font Arial -pointsize "$exifPS" -fill yellow\
                        -gravity SouthWest -annotate +40+050 '%f' $d2/$s2/$f2
            fi
            cvstat=$?                         # capture status returned by convert
            if ((cvstat)); then ((tcvs1=+1));((tcvs=+1)); # count errs current & all subdirs
               echo "convert annotate ERROR# $tcvs for $d1/$s1/$f1";
            fi
            ((tsd1j+=1))       # count .jpg's annotated
         else
           cp $d1/$s1/$f1 $d2/$s2/$f2  # copy non .jpg's copied unchanged
           ((tsd1x+=1))       # count others (not .jpg's)
         fi
       }
     echo "$tsd1j .jpg's date-time stamped from $d1/$s1 to $d2/$s1"
     if ((tsd1x)); then echo "$tsd1x non-jpgs copied unchanged from $d1/$s1/..."; fi
     if ((tcvs1)); then echo "$tcvs1 convert annotate ERRORs in $d1/$s1/..."; fi
   }
 echo "$tsd subdirs processed from $d1/... to $d2/... "
 echo "$tsdj .jpg's date-time stamped from $d1/... to $d2/... "
 if ((tsdx)); then echo "$tsdx TOTAL non-jpgs copied unchanged to $d2/..."; fi
 if ((tcvs)); then echo "$tcvs convert annotate TOTAL ERRORs in $d1/..."; fi
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B4. DTstamp4 - annotate all photos in all subdirs in all super-dirs

 #!/bin/bash
 # DTstamp4 - annotate filenames on all photos in all directories of all super-directories
 #            for the 20 years of camera photos collected by Owen Townsend.
 #          - calls DTstamp3 for each year. The years were hard-coded in the script,
 #            so DTstamp4 is not general purpose as are DTstamp1,2,3.
 #          - overlays date/time stamp on bottom edge of .jpg photos
 #          - by Owen Townsend, UV Software, Jan 2022, update Feb 2022
 #          - see alternate scripts as follows:
 # DTstamp1 - processes dir1/1file to dir2/1file
 # DTstamp2 - processes dir1/all*files to dir2/all*files
 # DTstamp3 - processes dir1/all*subdirs/all*files to dir2/all*subdirs/all*files
 #*DTstamp4 - calls DTstamp3 to annotate .jpg photos with filenames & Date/Time stamps
 #            for all superdirs of photos by year (2002 - 2022)
 echo "DTstamp4 - calls DTstamp3 to annotate .jpg photos with filenames & Date/Time stamps"
 echo " - for all photos in superdirs/subdirs/files yeardirs/datesubdirs/files"
 echo " - hard-coded years used by Owen Townsend, example 1st & last of 22 years"
 echo "DTstamp3 2002 2002DTS"
 echo "  ------ etc -----"
 echo "DTstamp3 2022 2022DTS"
 echo " - must be in Global-dir 'photosD' with 21 years of input dirs 2002,2003,etc...2022"
 echo "DTstamp3 will make the output directory specified by arg2"
 until [[ "$reply" == "y" || "$reply" == "n" ]]
   do echo "DTstamp4 - annotate filenames in all subdirs for Owens 21 years of photos - proceed y/n ?"
      read reply; done
 if [[ "$reply" == "n" ]]; then
    echo "reply=n, job cancelled"; exit 92; fi
 #
 echo "DTstamp4 (for Owen's year dirs 2002-2021) BEGUN at $(date)"
 DTstamp3 2002 2002DTS
 DTstamp3 2003 2003DTS
 DTstamp3 2004 2004DTS
 DTstamp3 2005 2005DTS
 DTstamp3 2006 2006DTS
 DTstamp3 2007 2007DTS
 DTstamp3 2008 2008DTS
 DTstamp3 2009 2009DTS
 DTstamp3 2010 2010DTS
 DTstamp3 2011 2011DTS
 DTstamp3 2012 2012DTS
 DTstamp3 2013 2013DTS
 DTstamp3 2014 2014DTS
 DTstamp3 2015 2015DTS
 DTstamp3 2016 2016DTS
 DTstamp3 2017 2017DTS
 DTstamp3 2018 2018DTS
 DTstamp3 2019 2019DTS
 DTstamp3 2020 2020DTS
 DTstamp3 2021 2021DTS
 DTstamp3 2022 2022DTS
 echo "DTstamp4 (for Owen's year dirs 2002-2022) ENDED at $(date)"
 # could now remove the input superdirs & remove the 'DTS' suffixes from output superdirs
 # to retain original naming structure in photosD as in photosC or photosA
 # rm -rf 20[01][0-9]
 # ==================
 # rename-X . DTS  <-- script 'rename-X' removes arg2 suffix from all entries in arg1 dir
 # ==============

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C1. Preparation to run Demo Executions using Test files provided

Login to run Demo Executions using Test files provided

You can execute DTstamp demos using a set of test dirs/files that are provided in $UV/demo/testphotos/... You would need Vancouver Utilities installed on your machine, or you would need a userid/password for one of the UV Software website guest logins. Here are the instructions to login to a guest website

On-Line Login to run DTstamp1,2,3 Demos


 #1. ssh uvsoftxx@uvsoftware.ca  <-- Online userid in range uvsoft00-uvsoft99
     ==========================
     --> passxx                  <-- enter your password at the prompt
                                   - assigned to you by UV Software

 #2.  cdm --> $HOME/uvsoftxx/demo
      ===
Note
  • 'cdm' is an alias to change to the demo directory (alias cdm='cd $HOME/demo')

Off-Line Alternative Login to run DTstamp1,2,3 Demos


 #1. Login userxx   <-- Alternative Login ON YOUR OWN MACHINE
     ============       if YOU HAVE DOWNLOADED & INSTALLED VANCOUVER UTILITIEs
     --> passxx      <-- enter your password at the prompt
                       - assigned to you by YOURSELF or your SYSADM

 #2. mkdir demo     <-- make a demo directory (if not already present)
     ==========

 #3. cd demo   <-- change into your demo directory
     =======

 #4. cdm       <-- OR use handy alias cdm='cd $HOME/demo'
     ===         - works from anywhere on your system

 #5. pwd   <-- confirm you are in your $HOME/demo directrory
     ===   --> will show: /home/userxx/demo, userxx is your login (john,mary,etc)

 #6. cp -r $UV/demo/* .  <-- copy all $UV/demo subdirs/files to your homedir/demo/...
     ==================
Note1
  • Off-Line users need to copy demo/* files from $UV/demo/* to $HOME/demo/...
  • On-Line users with guest login/password do not need to (already setup)
    but you could re-copy from $UV/demo to your $HOME/demo if you make mistakes

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D1. Preparation to Demo Annotating photos (overlay filenames)

Test Files to demo DTstamp1,2,3

Note
  • Input files to DTstamp1,2,3 are the Outputs from renameIMG2, which inserted
    date/time prefixes on the original filenames from digital cameras

We assume you have Vancouver Utilities installed on your machine, OR you have a UV Software guest userid/password & have used 'ssh' to login. (See Logins for either described on the previous page).


 #01.  cdm    <-- ensure you are in $HOME/uvsoftxx/demo
       ===      - online userids assigned by UV Software uvsoft01-uvsoft99
                - offline userids assigned by you or sysadm (VU installed on your machine)

 #02. cd testphotos   <-- change into Top-dir for Photo-Rename demo
      =============     - $HOME/demo/testphotos

 #03. tree -L 1       <-- tree diagram of Top (Level 1) dirs in $HOME/demo/testphotos/...
      =========
 $HOME/userxx/testphotos/
 |-- photosA         <-- Legacy photos, listed below
 |-- photosB         <-- Working dir for renameIMG project in Part 1
 |-- photosC         <-- renameIMG outputs with Date/Time prefixes inserted
 |--                   - renameIMG results, original subdir names restored (years/dumpdates)
 `-- photosD         <-- Working dir to Annotate date_time_filenames
                       - will copy inputs from photosC/* to photosD/... before test begin

 #04. tree photosA   <-- tree diagram of original inputs from cameras BEFORE DATE/TIME INSERT
      ============     - photosA/... was input to the renameIMG project in Part 1
 $HOME/userxx/testphotos/
 |-- photosA                 <------ Legacy photos (only a few for this demo)
 |   |-- 2002                  <---- superdir for each year
 |   |   |-- 20020809            <-- subdir whenever camera dumped to computer
 |   |   |   |-- dscf0001.jpg
 |   |   |   |-- dscf0002.jpg    <-- photo files within date-dumped subdir
 |   |   |   `-- dscf0003.jpg      - DATE_TIMEs inserted in photosB/... (see next page)
 |   |   `-- 20020910
 |   |       |-- dscf0001.jpg    <-- camera reassigned duplicate names
 |   |       |-- dscf0002.jpg        after each camera dump & clear for next batch
 |   |       `-- dscf0003.jpg
 |   |-- 2003
 |   |   |-- 20030116
 |   |   |   |-- p1160051.jpg
 |   |   |   |-- p1160052.jpg   <-- various cameras assigned names differently
 |   |   |   `-- p1160053.jpg
 |   |   `-- 20030506
 |   |   |   |-- img_1050.jpg
 |   |   |   |-- img_1581.jpg
 |   |   `   `-- img_1655.jpg
 |   |-- 20xx                   <-- could be many more years of Legacy photos
 |   |                            - only 2002 & 2003 for this demo
 |-- photosB                    <-- Working dir (see subdirs/files listed next page)
 |-- photosC                    <-- renameIMG outputs with Date/Time prefixes inserted
 `-- photosD                    <-- Annotate with date_time_filenames

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D2. Test Files to demo DTstamp1,2,3

Inputs to DTstamp1,2,3 from Part1 with DATE/TIME prefixes


 #05. tree photosB
      ============
 $HOME/demo/testphotos/photosB
 |-- photosB
 |   |-- 2002                                  <--- Input photos in yyyy superdir
 |   |   |-- 20020809                          <-- yyyymmdd subdirs for camera dumpdates
 |   |   |   |-- dscf0001.jpg
 |   |   |   |-- dscf0002.jpg                  <-- original photo names
 |   |   |   `-- dscf0003.jpg
 |   |   `-- 20020910
 |   |       |-- dscf0001.jpg                  <-- original photo names duplicated
 |   |       |-- dscf0002.jpg                       when camera dumped & cleared for new batch
 |   |       `-- dscf0003.jpg
 | * |-- 2002DT                                <--- Output photos in yyyyDT superdir
 | * |   |-- 20020809                          <-- same subdir names OK within yyyyDT superdirs
 | * |   |   |-- 20020808_150303_dscf0001.jpg
 | * |   |   |-- 20020809_124429_dscf0002.jpg  <-- Date/Time prefixes inserted on jpg files
 | * |   |   `-- 20020814_073829_dscf0003.jpg
 | * |   `-- 20020910
 | * |       |-- 20020905_043715_dscf0001.jpg
 | * |       |-- 20020905_110856_dscf0002.jpg
 | * |       |-- 20020907_064348_dscf0003.jpg
 |   |-- 2003                                  <-- 2nd year Input (of only 2 years for test)
 |   |   |-- 20030116                            - author had 20 years of Legacy photos
 |   |   |   |-- p1160051.jpg
 |   |   |   |-- p1160052.jpg
 |   |   |   `-- p1160053.jpg
 |   |   `-- 20030506
 |   |       |-- img_1050.jpg
 |   |       |-- img_1581.jpg
 |   |       `-- img_1655.jpg
 | * |-- 2003DT                                <-- 2nd year Output (ID by 'DT' suffix)
 | * |   |-- 20030116
 | * |   |   |-- 20050115_122920_p1160051.jpg
 | * |   |   |-- 20050116_131436_p1160052.jpg
 | * |   |   `-- 20050116_155634_p1160053.jpg
 | * |   `-- 20030506
 | * |       |-- 20161016_044043_img_1050.jpg
 | * |       |-- 20170507_085722_img_1581.jpg
 | * |       `-- 20180506_084904_img_1655.jpg
 |   `
 |-- photosC          <-- '*' outputs from Part1 renameIMG2 were copied to photosC
 |   |-- 2002           - 'DT' suffixes dropped to restore original historical names
 |   |   |-- 20020809   - yyyymmdd subdirs named from camera dump dates during year
 |   `
 |-- photosD          <-- photosD/... copied from photosC/... before annotating
 |   |-- 2002           - see photosD files listed on next page
 |   |   |-- 20020809

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D3. Test Files to demo DTstamp1,2,3

copy outputs of Part1 renameIMG2 for Part2 DTstamp1,2,3


 #06. cd $HOME/demo/testphotos   <-- change above photosA,B,C,D
      ========================

 #07. cp -r photosC/* photosD/   <-- copy photosC/* to photosD/... for DTstamp1,2,3
      ========================

 #08. tree photosD              <-- list Input files to demo Dtstamp1,2,3
      ============
 photosD
 |-- 2002
 |   |-- 20020809
 |   |   |-- 20020808_150303_dscf0001.jpg
 |   |   |-- 20020809_124429_dscf0002.jpg
 |   |   `-- 20020814_073829_dscf0003.jpg
 |   `-- 20020910
 |       |-- 20020905_043715_dscf0001.jpg
 |       |-- 20020905_110856_dscf0002.jpg
 |       `-- 20020907_064348_dscf0003.jpg
 `-- 2003
     |-- 20030116
     |   |-- 20050115_122920_p1160051.jpg
     |   |-- 20050116_131436_p1160052.jpg
     |   `-- 20050116_155634_p1160053.jpg
     `-- 20030506
         |-- 20161016_044043_img_1050.jpg
         |-- 20170507_085722_img_1581.jpg
         `-- 20180506_084904_img_1655.jpg

Part1 renameIMG2 Outputs (with date/time prefixes) Input to Part2 DTstampa1,2,3,4

 Outputs of DTstamp1,2,3,4 will have the same filenames as the inputs,
 - BUT will be annotated with the filename overlays along bottom edge
 - will append DTS on output directories (2002DTS, 2003DTS, etc)
 photosD
 |-- 2002DTS
 |   |-- 20020809
 |   |   |-- 20020808_150303_dscf0001.jpg
        -------- etc --------

On completion, we can delete the input directories & change the output directory names back to the original year direcctory names

 photosD
 |-- 2002          <-- drop 'DTS' suffixes from year superdir names
 |   |-- 20020809      to restore original historical directory year names
 |   |   |-- 20020808_150303_dscf0001.jpg
        -------- etc --------

Directory/Filenames will be the same, but photos now annotated (overlaid with yyyymmdd_HHMMSS_filenames along bottom edge

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E0. Test/Demo DTstamp1,2,3 to Annotate photos with filenames

Preparation to test/demo Execute DTstamp1,2,3,4


 #01. Login (if not already, see page '2C1')
      ======
 #01a. ssh uvsoftxx@uvsoftware.ca  <-- Online with guest userid/password
       ==========================
 #01b. Login userxx                <-- Or on YOUR OWN MACHINE
       ============                    with Vancouver Utilities installed

 #02a. cdm --> $HOME/uvsoftxx/demo  <-- alias change to $HOME/demo/...
       ===
 #02b. cd testphotos   <-- change to super-dir for photo test/demos
       =============
 #02c. cd photosD      <-- change to sub-dir for Annotation test/demos
       ==========

 #03. tree photosD              <-- list Input files to demo Dtstamp1,2,3
      ============
      photosD
      |-- 2002
      |   |-- 20020809
      |   |   |-- 20020808_150303_dscf0001.jpg
      |   |   |-- 20020809_124429_dscf0002.jpg
      |   |   `-- 20020814_073829_dscf0003.jpg
      |   `-- 20020910
      |       |-- 20020905_043715_dscf0001.jpg
      |       |-- 20020905_110856_dscf0002.jpg
      |       `-- 20020907_064348_dscf0003.jpg
      `-- 2003
          |-- 20030116
          |   |-- 20050115_122920_p1160051.jpg
          |   |-- 20050116_131436_p1160052.jpg
          |   `-- 20050116_155634_p1160053.jpg
          `-- 20030506
              |-- 20161016_044043_img_1050.jpg
              |-- 20170507_085722_img_1581.jpg
              `-- 20180506_084904_img_1655.jpg

 #04a. mkdir 2002DTS    <-- make output directory for each year
       =============
 #04b. mkdir 2003DTS    <-- ONLY 2 years (2002,2003) for our test files
       =============      - Owen had 21 years of photos (2002-2022)

 #05a. mkdir tmp1 tmp2      <-- make output dirs for DTstamp1 & DTstamp2
       ===============
 #05b. rm -f tmp1/* tmp2/*  <-- OR remove files if tmp1/ & tmp2/ already exist
       ===================
Note
  • DTstamp1 will use tmp1/... for output (only 1 file at a time)
  • DTstamp2 will use tmp2/... for output (only 1 directory at a time)
  • DTstamp3 will make subdirs as needed within the output directory

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E1. Test DTstamp1 - Annotate 1 file at a time

Assumptions for DTstamp1


 #01. DTstamp1 2002/20020809/20020808_150303_dscf0001.jpg tmp1/20020808_150303_dscf0001.jpg
      =====================================================================================
       - annotate filename overlay on bottom edge of photo

 #02. l tmp1     <-- list output file
      ======
      tmp1/20020808_150303_dscf0001.jpg
      =================================
       - filename will be the same, need to use GUI screen to see annotation

 #03a. View output photo using a GUI screen - IF on your own computer with VU installed
       ================================================================================
       - GUI screen will be Function F2 (CLI screens will be F3-F6)
       - navigate to $HOME/demo/testphotos/photosD/tmp1/
       - doubleclick on: 20020808_150303_dscf0001.jpg

 #03b. View output photo - If using a userid/password guest login on UV Software's website
       ===================================================================================
       - You probably will not be able to display the photo & see annotation
       - You could sftp the photo back to your machine (linux or windows)
       - OR trust us & look at our result on the website at:
       https://uvsoftware.ca/uvadm/demo/testphoto/photosD/tmp1

 #04. Repeat above for other subdirs/photos if/as desired
      ===================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E2. Test DTstamp2 - Annotate all files in a directory

Assumptions for DTstamp2


 #01. mkdir tmp2/20020809    <-- make output subdir in tmp2/...
      ===================        matching input subdir name

 #02. DTstamp2 2002/20020809 tmp2/20020809
      ====================================
      - annotate all files while copying from 2002/20020809/* to tmp2/20020809/...

 #03. tree tmp2     <-- list output files
      =========
      tmp/20020809
      |-- 20020808_150303_dscf0001.jpg
      |-- 20020809_124429_dscf0002.jpg
      `-- 20020814_073829_dscf0003.jpg

 #04a. View output photos using a GUI screen - IF on your own computer with VU installed
       =================================================================================
       - GUI screen will be Function F2 (CLI screens will be F3-F6)
       - navigate to $HOME/demo/testphotos/photosD/tmp2/
       - doubleclick on photos in tmp2/...

 #04b. View output photos - If using a userid/password guest login on UV Software's website
       ====================================================================================
       - You probably will not be able to display the photos & see annotations
       - You could sftp the photos back to your machine (linux or windows)
       - OR trust us & look at our results on the website at:
       https://uvsoftware.ca/uvadm/demo/testphoto/photosD/tmp2/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E3. Test DTstamp3 - Annotate all files in all subdirs of a superdir

Assumptions for DTstamp3


 #01a. DTstamp3 2002 2002DTS
       =====================
       - annotate all subdirs/files while copying from 2002/* to 2002DTS/...

 #01b. DTstamp3 2003 2003DTS
       =====================
       - annotate all subdirs/files while copying from 2003/* to 2003DTS/...

 #02a. tree 2002DTS   <-- list DTstamp3 outputs from 2002/...
       ============
       2002DTS
       |-- 20020809
       |   |-- 20020808_150303_dscf0001.jpg
       |   |-- 20020809_124429_dscf0002.jpg
       |   `-- 20020814_073829_dscf0003.jpg
       `-- 20020910
           |-- 20020905_043715_dscf0001.jpg
           |-- 20020905_110856_dscf0002.jpg
           `-- 20020907_064348_dscf0003.jpg

 #02b. tree 2003DTS   <-- list DTstamp3 outputs from 2003/...
       ============
       2003DTS
       |-- 20030116
       |   |-- 20050115_122920_p1160051.jpg
       |   |-- 20050116_131436_p1160052.jpg
       |   `-- 20050116_155634_p1160053.jpg
       `-- 20030506
           |-- 20161016_044043_img_1050.jpg
           |-- 20170507_085722_img_1581.jpg
           `-- 20180506_084904_img_1655.jpg

 #03a. View output photos using a GUI screen - IF on your own computer with VU installed
       =================================================================================
       - GUI screen will be Function F2 (CLI screens will be F3-F6)
       - navigate to $HOME/demo/testphotos/photosD/2002DTS/.../... & doubleclick photos

 #03b. View output photos - If using a userid/password guest login on UV Software's website
       ====================================================================================
       - You probably will not be able to display the photos & see annotations
       - You could sftp the photos back to your machine (linux or windows)
       - OR trust us & look at our results on the website at:
       https://uvsoftware.ca/uvadm/demo/testphoto/photosD/2002DTS/.../...<

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_3. FaceId - Identify Faces in photos

Part 3 FaceID - Contents

FaceID scripts (FaceId1,2,3,4) are intended to Identify Faces for 1 photo, all in a subdir, all subdirs in a superdir, or all subdirs in all superdirs. using photos of known people to create filename filename lists of input photos followed by the filenames of the known people recognized.

We can then use the photo filename/people lists to copy the photo files, renaming the files to include the person initials, For example:

For an input photo named 'yyyymmdd_HHMMSS_dscf0001.jpg, the output file might be named 'yyyymmdd_HHMMSS_OtJtMc.jpg', where 'OtJtMc' are intials for Owen Townsend, Jill Townsend,& Mia Cameron.

This Allows you to select photos including known persons using command line tools (such as 'ls'), without having to view the photos (a very slow process).

Part3 FaceId is not yet available as of Feb 2022. We are still evaluating which 3rd party software tool to use. I am investigating the 'face_recognition' package by Adam Geitgey.


See: https://github.com/ageitgey/face_recognition

OR: https://face-recognition.readthedocs.io/en/latest/readme.html#features

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Visitor Counters for ThisYear and LastYear