Scripts for copying files from SD cards, extracting EXIF

from G3X:

--> more get3 #!/bin/bash ################ ## 2 Dec 2018 - get G3X images from SD card ################ THISPWD=`pwd` echo $THISPWD echo "--> dfh" dfh echo "== getting G3X images ==========================================" echo "--> ls /Volumes/CANON_G3X/DCIM" ls /Volumes/CANON_G3X/DCIM/ ################################################### #### UPDATE THIS DIRECTORY EVERY MONTH: ####### ################################################### # cd /Volumes/CANON_G3X/DCIM/282___11/ cd /Volumes/CANON_G3X/DCIM/283___12/ ######################################## pwd ls * | awk -F _ '{print "mv "$1"_"$2" G3X_"$2}' | tee tmpg3x sh ./tmpg3x rm -f tmpg3x cd $THISPWD pwd ls echo "== getting G3X images ==========================================" ################################################### #### UPDATE THIS DIRECTORY EVERY MONTH: ####### ################################################### # mv /Volumes/CANON_G3X/DCIM/282___11/* . mv /Volumes/CANON_G3X/DCIM/283___12/* . ######################################## ls sudo umount /Volumes/CANON_G3X/ ; ls echo "== finished getting G3X images ==========================================" ls

from G7X

--> cat get7 #!/bin/bash ############################ # 2 Dec 2018 get g7x images ############################ THISPWD=`pwd` echo $THISPWD echo "--> dfh" dfh echo "== getting G7X images ==========================================" echo "--> ls /Volumes/CANON_DC/DCIM" ls /Volumes/CANON_DC/DCIM/ ################################################### #### UPDATE THIS DIRECTORY EVERY MONTH: ####### ################################################### # cd /Volumes/CANON_DC/DCIM/130___11/ cd /Volumes/CANON_DC/DCIM/131___12/ ######################################## pwd ls * | awk -F _ '{print "mv "$1"_"$2" G7X_"$2}' | tee tmpg7x sh ./tmpg7x rm -f tmpg7x cd $THISPWD pwd ls echo "== getting G7X images ==========================================" ################################################### #### UPDATE THIS DIRECTORY EVERY MONTH: ####### ################################################### # mv /Volumes/CANON_DC/DCIM/130___11/* . mv /Volumes/CANON_DC/DCIM/131___12/* . ######################################## ls sudo umount /Volumes/CANON_DC/ ; ls echo "== finished getting G7X images ==========================================" ls

from nikon

--> cat getnikon #!/bin/bash # mv /Volumes/CANON_DC/DCIM/105___01/* . ; sudo umount /Volumes/CANON_DC/ ; ls # mv /Volumes/NIKON_D750/DCIM/102ND750/* . ; sudo umount /Volumes/NIKON_D750/ ; ls # /Volumes/NIKON_D750/DCIM/103ND750/ # mv /Volumes/NIKON_D750/DCIM/103ND750/* . ; sudo umount /Volumes/NIKON_D750/ ; ls # /Volumes/NIKON_D850/DCIM/100ND850/ mv /Volumes/NIKON_D850/DCIM/100ND850/* . ; sudo umount /Volumes/NIKON_D850/ ; ls

extracting exif data using exiftool

--> cat exif-strip.sh #!/bin/bash # uses exiftool to extract EXIF info in original images # for x in `ls *` do exiftool $x > exifinfo-$x.txt cat exifinfo-$x.txt | \ grep -E -v '(Brightness|Timezone|ISO2|Zone|Bracket|Image|Artist|Crop|Sensitivity|\ Preview|Difference|Shift|MIME|Tuning|Clarity|Serial|Mode|Modify|Distance|Confusion|\ Gain|Tune|Phase|CFA|Depth|Hyper|Light|Mega|Red|Blue|GPS|Normal|TIFF|Jpg|Binary|Sub|\ Memory|Original|File|Directory|Sensing|Size|Power|Multi|Raw|Contrast|Vari|Retouch|Max|\ Compression|Exit|Comment|Primary|MCU|Version|Shot|Position|Picture|Black|Control|Points|\ Expansion|Zoom|Toning|Hue|Filter|Format|Min|Color|Quality|Levels|Flash|Scene|Other|Planar|\ Resolution|Copyright|Strip|Balance|Bits|Stops|Samples|Software|Orientation|Byte|Make|\ Savings|Scale)' > base-exif-$x.txt done mkdir ../EXIFINFO mv exifinfo-*.txt ../EXIFINFO mv base-exif-*.txt ../EXIFINFO #############################################################3 # cat JM7_0504.NEF-exifinfo.txt | \ grep -E -v '(ISO2|Zone|Bracket|Image|Artist|Crop|Sensitivity|Preview|Difference|Shift|\ MIME|Tuning|Clarity|Serial|Mode|Modify|Distance|Confusion|Gain|Tune|Phase|CFA|Depth|\ Hyper|Light|Mega|Red|Blue|GPS|Normal|TIFF|Jpg|Binary|Sub|Memory|Original|File|Directory|\ Sensing|Size|Power|Multi|Raw|Contrast|Vari|Retouch|Max|Compression|Exit|Comment|Primary|\ MCU|Version|Shot|Position|Picture|Black|Control|Points|Expansion|Zoom|Toning|Hue|Filter|\ Format|Min|Color|Quality|Levels|Flash|Scene|Other|Planar|Resolution|Copyright|Strip|\ Balance|Bits|Stops|Samples|Software|Orientation|Byte|Make|Savings|Scale)' | sort

--> cat base-exif.sh #!/bin/bash # uses exiftool to extract EXIF info in original images # for x in * do exiftool $x > exifinfo-$x.txt cat exifinfo-$x.txt| grep -E -v '(Brightness|Timezone|ISO2|Zone|Bracket|Image|Artist|\ Crop|Sensitivity|Preview|Difference|Shift|MIME|Tuning|Clarity|Serial|Mode|Modify|Distance|\ Confusion|Gain|Tune|Phase|CFA|Depth|Hyper|Light|Mega|Red|Blue|GPS|Normal|TIFF|Jpg|Binary|Sub|\ Memory|Original|File|Directory|Sensing|Size|Power|Multi|Raw|Contrast|Vari|Retouch|Max|Compression|\ Exit|Comment|Primary|MCU|Version|Shot|Position|Picture|Black|Control|Points|Expansion|Zoom|Toning|\ Hue|Filter|Format|Min|Color|Quality|Levels|Flash|Scene|Other|Planar|Resolution|Copyright|Strip|\ Balance|Bits|Stops|Samples|Software|Orientation|Byte|Make|Savings|Scale)' > base-exif-$x.txt done mkdir ../EXIFINFO mv exifinfo-*.txt ../EXIFINFO mv base-exif-*.txt ../EXIFINFO #############################################################3 # cat JM7_0504.NEF-exifinfo.txt | grep -E -v '(ISO2|Zone|Bracket|Image|Artist|Crop|Sensitivity|\ Preview|Difference|Shift|MIME|Tuning|Clarity|Serial|Mode|Modify|Distance|Confusion|Gain|Tune|\ Phase|CFA|Depth|Hyper|Light|Mega|Red|Blue|GPS|Normal|TIFF|Jpg|Binary|Sub|Memory|Original|File|\ Directory|Sensing|Size|Power|Multi|Raw|Contrast|Vari|Retouch|Max|Compression|Exit|Comment|Primary|\ MCU|Version|Shot|Position|Picture|Black|Control|Points|Expansion|Zoom|Toning|Hue|Filter|Format|Min|\ Color|Quality|Levels|Flash|Scene|Other|Planar|Resolution|Copyright|Strip|Balance|Bits|Stops|\ Samples|Software|Orientation|Byte|Make|Savings|Scale)' | sort

renaming files created with jpeg back to jpg

--> more convert-jpeg-jpg.txt 1) ls *.jpeg > fix 2) :%s/.*/mv & &-_eLi.jpg/g 3) :%s/_eLie.jpeg-_eLi.jpg/_eLi.jpg/g 4) sh ./fix

using rsync to copy files to external drive on a Mac

--> more sync-5TB-FOTOS #!/bin/bash # rsync -Prvlpth --progress /Users/luser/Pictures/2018/ /Volumes/5TB-FOTOS/2018/

make a page

--> cat ~/bin/mkpg #!/bin/bash # 28 oct 2013 - john http://johnmeister.com - updated 8 may 2015 # updated date in title to 2017 - 30 Dec 2016 - update 1jan2018 # updating 12 Sep 2018 - not saving IMG.html, updating missing.html ################################################################# # mkpg - creates a page to display all images in a directory ################################################################# CAT=/usr/bin/cat CP=/usr/bin/cp DATE=`date | cut -c 5-11` ; export DATE # echo $DATE FDATE=`/bin/date +%d%b%y-%H%M` ; export FDATE # echo $FDATE GREP=/usr/bin/grep LS=/usr/bin/ls MKDIR=/usr/bin/mkdir MV=/usr/bin/mv PERL=/usr/bin/perl RM=/usr/bin/rm SORT=/usr/bin/sort TITLE="`echo "$1"`" ; export TITLE ; echo $TITLE UNIQU="/usr/bin/uniq -u" VI=/usr/bin/vi WCL="/usr/bin/wc -l" ############################################## # create backup copies of ALL, Header, Readme and footer files ############################################## $MKDIR x 2>/dev/null $MV ALL.html x/ALL.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV README.html x/README-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV HEADER.html x/HEADER-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV FOOTER.html x/FOOTER-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null ############################################## $CP /home/luser/web/README.html README.html $CP /home/luser/web/HEADER.html HEADER.html $LS z ############################################## # create new ALL.html file - TOP ############################################## echo "<html><head><title>$TITLE - john meister © 2018</title>" > ALL.html $CAT /home/luser/bin/BASE/A >> ALL.html ############################################## # create <h1> tag for page - take from mkpg cmd ############################################## echo "" >> ALL.html echo "<center><h1> $TITLE </h1>" >> ALL.html ############################################## # image tags and place D850, D750, P1000, canon files ############################################## $LS *.jpg > IMGs 2>/dev/null $LS *.JPG >> IMGs 2>/dev/null # echo "----------- 1 " $CAT IMGs | $GREP JM8 > IMG.html 2>/dev/null $CAT IMGs | $GREP JM7 >> IMG.html 2>/dev/null $CAT IMGs | $GREP DSCN >> IMG.html 2>/dev/null $CAT IMGs | $GREP IMG >> IMG.html 2>/dev/null $CAT IMGs | $GREP JM6 >> IMG.html 2>/dev/null $CAT IMGs | $GREP D7K >> IMG.html 2>/dev/null $CAT IMGs | $GREP JEM >> IMG.html 2>/dev/null $LS *.jpg *.JPG 2>/dev/null | $GREP -v JM8 | $GREP -v JM7 | $GREP -v JM6 | $GREP -v DSCN | $GREP -v JEM | $GREP -v IMG >> IMG.html 2>/dev/null

# echo "----------- 2 " $PERL -pi -e 's/(.*)/<img src="$1"><BR>$1<HR>/g' IMG.html 2>/dev/null $PERL -pi -e 's/<img src=""><BR><HR>//g' IMG.html 2>/dev/null ############################################## $CAT IMG.html >> ALL.html ############################################## # close out content section, add Footer ############################################## echo "</center>" >> ALL.html $CAT /home/luser/bin/BASE/B >> ALL.html # echo " the numbers on the left should match: " # $MV IMGs x # ; $WCL x/IMGs # $MV IMG.html x # ; $WCL x/IMG.html # echo " end of ALL.html creation, backup files in z " $RM IMGs ; $RM IMG.html ##############################################


make avi from a series of jpg images

basic process: 1: ls *.jpg > files.txt 2: mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o test.avi -mf type=jpeg:fps=20 mf://@files.txt 3: mv test.avi /some/dir/name-by-date.avi #!/bin/bash # john meister 14nov2013 # updating mkavi to mkallavi to include two directories 9 may 2015 # DIRNAME=`pwd | awk -F / '{print $4}'` ##### /var/www/thisdomain/public_html/Time_Lapse/2015_04_07 (7th field) ####################################################################################################### DIRNAME=`pwd | awk -F / '{print $7}'` # note this directory chmod 644 *.jpg find . -type f -size 0 -exec rm {} \; ls *.jpg > $DIRNAME.files.txt mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o $DIRNAME.avi -mf type=jpeg:fps="24" mf://@$DIRNAME.files.txt /home/john/bin/mkpg "Time Lapse $DIRNAME" echo "$DIRNAME.avi " | tee -a ../Daily_Time_Lapse_2015.html ####################################################################################################### mkdir /var/www/Driveway/$DIRNAME scp -rp remote_account@silver-edge.dreamhost.com:/home/remote_account/johnmeister.com/jeep/sj/driveway/$DIRNAME /var/www/Driveway/ cd /var/www/Driveway/$DIRNAME chmod 644 *.jpg find . -type f -size 0 -exec rm {} \; ls *.jpg > $DIRNAME.files.txt mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o $DIRNAME.avi -mf type=jpeg:fps="24" mf://@$DIRNAME.files.txt /home/john/bin/mkpg "Time Lapse $DIRNAME" echo "$DIRNAME.avi" | tee -a ../Daily_Time_Lapse_2015.html scp *.avi ALL.html README.html remote_account@silver-edge.dreamhost.com:/home/remote_account/johnmeister.com/jeep/sj/driveway/$DIRNAME scp ../Daily_Time_Lapse_2015.html remote_account@silver-edge.dreamhost.com:/home/remote_account/johnmeister.com/jeep/sj/driveway/ cd #######################################################################################################


JohnMeister.com Today's Date:

Simply Linux: Basics  Full Size Jeep Buyer's Guide Using BASH on Windows 10
Practical Suggestions for Microsoft Windows
Linux Tackles Microsoft
Video Course:
The Art of Linux System Administration, and a
Study Guide for the LPIC-2 Certification Exams.

-- O'Reilly Media author info
FULL SIZE JEEP

Buyer's Guide

SJ Jeeps

"Jeep is America's
only real sports car."
-Enzo Ferrari


Mercedes, VW, and other Diesels
Nikon cameras
general tech info
AMSOIL product guide,
or, AMSOIL web, or 1-800-956-5695,
use customer #283461

Amsoil dealer since 1983

purchase AMSOIL and have it
installed locally in WA at:

- Northland Diesel 360.676.1970 - Bellingham
- Midway Auto 360.668.7111 - Clearview/Snohomish
- Fleet Services 425.355.4440 - Everett