You are here:
> Bash scripts
> Copying images and videos from your camera or phone
> Bash scripts
> Copying images and videos from your camera or phone
It's a pain when you take a few photos using your phone, you connect it and then need to remember where they are stored on the card, open up the folder where you want to copy them to, etc.
You could use rsync to do this, but I have just written a little script to make it easy:
#!/bin/sh
echo "Copying new images..";
cp -Ruv `dirname $0`/Images/* '/home/rdy/Desktop/images/source/from_phone/';
echo "Copying new videos..";
find `dirname $0`/Videos -maxdepth 99 -iregex ".*(mp4|3gp)$" -exec cp -uv {} '/home/rdy/Desktop/images/video/source/from phone/' ;
echo "Done.";
sleep 2;
Roughly translated, the script will:
- copy from working directory (the directory the script was launched from) /Images/* to /home/rdy/Des... - you should change this
- copy from working directory /Videos with a maximum recursion depth of 99 (just so if there are some sub folders) anything that ends in mp4 or 3gp (case insensitive) to /home/rdy/... - you should change this
I also have a script that will copy the images and videos from my camera, which I use in the same way (a bash script stored on the memory card in the camera):
#!/bin/sh
echo "Copying new images..";
find `dirname $0`/10*_PANA/ -maxdepth 99 -iname *.jpg -exec cp -uv {} '/home/rdy/Desktop/images/source/from camera/' ;
echo "Copying new videos..";
find `dirname $0`/10*_PANA/ -maxdepth 99 -iname *.mov -exec cp -uv {} '/home/rdy/Desktop/images/video/source/from camera/' ;
echo "Done.";
sleep 2;
:: Page tags: bash :: Page last modified on Sun, 13 Dec 2009 ::