Re: [SLUG] trivial, but banging head on wall ...

2013-12-03 Thread Matt Hope
Random tips:

- You can use find in one command, rather then loop over the file extensions
find . -type f ! -name '*thumb*' \( -iname '*.tif' -o -iname '*.jpg'
-o -iname '*.jpeg' -o -name '*.orf' -o -name '*.nef' \)

- Might be a good idea to set IFS to '\0', combined with find's
-print0 argument, or set IFS to $'\n'.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] trivial, but banging head on wall ...

2013-12-03 Thread James Linder
Hi
First I thing that having spaces in filenames is like wearing a tee shirt 
saying "hit me!".

I'm trying to backup all my wife's pictures and although I can do any one file 
on CLI doing a script is humbling me. If anyone can help I'd be grateful. 
Thanks 

#!/bin/bash
HOST=j...@dvr.home:/mnt/photos

>list
let j=1
for i in tif jpg JPG jpeg ORF NEF
do
  find . -type f -name "*$i" |grep -v -i thumb | while read filename
  do
fn=`basename \"$filename\"`
#echo BN -- $fn >> list
fm=`echo $fn |sed 's/ /_/g'`
#echo CLEAN $fm >>list
echo scp \"$filename\" $HOST/\"$j.$fm\" >>list
let j=$j+1
  done
done

scp "READ ME" j...@dvr.home:"READ\\ ME"

This should and does work, but I've spent a 1/2 day fighting filename_with_a_" 
some where when trying to script it. The task is easy but messy, if all else 
fails I'll go on a fishing expedition with backslashes

James
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html