Skip to main content

Thread: Bash script sanity check


i haven't done ton of scripting in bash , wanted sanity check before started using. right works fine, wanted see if there possibly cause trouble. it's supposed copy contents of photo memory card, rename , move photos delete temp directory.

code:
#! /bin/bash set -e set -u path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games  source_dir=/media/canon_dc/dcim/ work_dir=/home/matt/phototmp1 target_dir=/home/matt/pictures mkdir $work_dir  find $source_dir -name "*.jpg" -type f -print0 | xargs -0 -i {} /bin/cp {} $work_dir  exiftool -v -d $target_dir/%y/%m/%d/%y%m%d_%h%m%s%%-c.%%e "-filename<createdate" $work_dir  rm -rf $work_dir

an additional question else has done similar. possible mark photos on photo card having been read? otherwise if forget delete photos memory card recopy of them , you'll have bunch of duplicates. don't want delete photos card automatically, since see potential lose photos if goes wrong initial copy.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Bash script sanity check


Ubuntu

Comments

Popular posts from this blog

Joomla 3.3 Installation Error message - Joomla! Forum - community, help and support

Multilanguage infinite redirect loop error. - Joomla! Forum - community, help and support

trim media limit reached