help with script SOLVED

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
mike acker
Level 6
Level 6
Posts: 1425
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

help with script SOLVED

Post by mike acker » Wed Jul 06, 2016 9:15 am

on my Canon 7D camera when i pull images using the tether cord the time on the images appears -4 hours
e.g. a picture taken at 1300 will have a file timestamp of 0900 ( the exif data is OK )
i'm guessing the camera fails to tell Linux that it is sending local time -- so Linux thinks 1300 is GMT -- and corrects it to EDT

now, to fix this i have tried to write a script:

Code: Select all

#!/bin/sh
#
# reset jpeg file by n hours
#
echo "correct *.JPG time stamps.   Enter hours, e.g. +4 for UTC to EDT"
read hrs_adj
echo "Adjustment will be " $hrs_adj " hours. "

read -p "Enter name of directory to be corrected" directory_name

echo "Directory name: " $directory_name

 for file_nm in "$directory_name"/*.JPG
  do
    echo "File name to touch: " "$file_nm"  
    # to increment time stamp relative to subject file
    touch -r "$file_nm" -d " $hrs_adj hour " "$file_nm"
  done
  
  echo "Corrected Directory:"
  ls -l "$directory_name"

echo "done"
the question is -- how should i type the directory name?

here's the target:

Code: Select all

~/Documents/1 Workareas/Workarea24 $ ls ~/Pictures/2016/"2016-07-05 lens tests"
2d set        VM2A7579.JPG  VM2A7587.JPG  VM2A7595.JPG  VM2A7603.JPG
VM2A7572.JPG  VM2A7580.JPG  VM2A7588.JPG  VM2A7596.JPG  VM2A7604.JPG
VM2A7573.JPG  VM2A7581.JPG  VM2A7589.JPG  VM2A7597.JPG  VM2A7605.JPG
VM2A7574.JPG  VM2A7582.JPG  VM2A7590.JPG  VM2A7598.JPG  VM2A7606.JPG
VM2A7575.JPG  VM2A7583.JPG  VM2A7591.JPG  VM2A7599.JPG  VM2A7607.JPG
VM2A7576.JPG  VM2A7584.JPG  VM2A7592.JPG  VM2A7600.JPG  VM2A7608.JPG
VM2A7577.JPG  VM2A7585.JPG  VM2A7593.JPG  VM2A7601.JPG  VM2A7609.JPG
VM2A7578.JPG  VM2A7586.JPG  VM2A7594.JPG  VM2A7602.JPG
but when i try to launch the script i cant hit the target:

Code: Select all

~/Documents/1 Workareas/Workarea24 $ ./touch4.scr
correct *.JPG time stamps.   Enter hours, e.g. +4 for UTC to EDT
+4
Adjustment will be  +4  hours. 
Enter name of directory to be corrected~/Pictures/2016/"2016-07-05 lens tests"
Directory name:  ~/Pictures/2016/"2016-07-05 lens tests"
File name to touch:  ~/Pictures/2016/"2016-07-05 lens tests"/*.JPG
touch: failed to get attributes of ‘~/Pictures/2016/"2016-07-05 lens tests"/*.JPG’: No such file or directory
Corrected Directory:
ls: cannot access ~/Pictures/2016/"2016-07-05 lens tests": No such file or directory
done
any hints/clues will be greatly appreciated!
Last edited by mike acker on Wed Jul 06, 2016 5:13 pm, edited 1 time in total.
¡Viva la Resistencia!

User avatar
cholq
Level 3
Level 3
Posts: 113
Joined: Tue Jul 08, 2014 9:27 pm
Location: New Jersey, USA

Re: help with script

Post by cholq » Wed Jul 06, 2016 9:22 am

what about trying this:

~/Pictures/2016/2016-07-05\ lens\ tests

User avatar
WharfRat
Level 21
Level 21
Posts: 13071
Joined: Thu Apr 07, 2011 8:15 pm

Re: help with script

Post by WharfRat » Wed Jul 06, 2016 9:25 am

Why not just use the exiftool timestamp

viewtopic.php?f=90&t=221155&hilit=touch#p1161341
ImageImage

mike acker
Level 6
Level 6
Posts: 1425
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: help with script SOLVED

Post by mike acker » Wed Jul 06, 2016 5:18 pm

Solution

in entering the directory: I have to enter:

Code: Select all

/home/mike/Pictures/Workarea24/EF35 v EF-S 15-85
I cannot use the shortcut in the script input: the following doesn't work:

Code: Select all

~/Pictures/Workarea24/EF35 v EF-S 15-85
¡Viva la Resistencia!

Post Reply

Return to “Newbie Questions”