James,
First I thing that having spaces in filenames is like wearing a
tee shirt saying hit me!.
Please remember that a pathname for valid POSIX filesystem may
contain anything except the null character.
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
If possible, just back everything up. I'd much rather waste a
bit of disk space than have to tell someone that I didn't backup
something because they didn't ask for it.
That said, here's a quick command based on your script - try putting
this into http://explainshell.com/ if you don't grok the mechanics:
find . -type f \( -iname \*.jpg -o -iname \*.tif -o -iname \*.jpeg -o -iname
\*.qrf -o -iname \*.nef \) -print0 |
cpio --null --format=crc --create |
ssh j...@dvr.home cd /mnt/photos \; cpio --make-directories
--preserve-modification-time --extract
The first command, find, just lists all the matching files with
a null character between the list. This will handle all kinds of
weird characters in the filenames.
The second command, cpio, reads a list of filenames from standard
input, expecting them to be separated with null characters and
creates an archive on standard out.
The third command, ssh, executes the given command on the remote
system. That command is in two parts: first change directory
into /mnt/photos and then extract the archive.
If you wanted to tradeoff CPU and RAM to save network bandwidth, this
might be a suitable variant, adding compression and decompression at the
inside of the pipeline over the ssh connection:
find . -type f \( -iname \*.jpg -o -iname \*.tif -o -iname \*.jpeg -o -iname
\*.qrf -o -iname \*.nef \) -print0 |
cpio --null --format=crc --create |
xz -9 --compress |
ssh j...@dvr.home cd /mnt/photos \; xz --decompress \| cpio
--make-directories --preserve-modification-time --extract
--
Mark Suter http://zwitterion.org/ | I have often regretted my
email addr su...@zwitterion.org | speech, never my silence.
mobile 0411 262 316 gpg FB1BA7E9 | Xenocrates (396-314 B.C.)
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html