Archive for September 4th, 2005

bash script to upload files from flash drive

September 4th, 2005

Here’s a useful little bash script I just wrote to upload photos from my flash card reader onto my laptop. The script is specific to the flash card file system used by my Canon EOS 300D, but should easily be adaptable for other uses. It is Free Open Source Software and is released under the GNU GPL license.

#! /bin/bash
MOUNTPOINT="/mnt/flash/"
FLASH_PHOTOROOT=$MOUNTPOINT"dcim/"
LOCAL_PHOTOROOT="/home/matthew/photos/"
mount -t msdos /dev/sda1 $MOUNTPOINT
DIR_LIST=`ls $FLASH_PHOTOROOT | grep .canon`
for dir in ${DIR_LIST}
do
if [ ! -d $LOCAL_PHOTOROOT${dir} ]; then
mv -v $FLASH_PHOTOROOT${dir} $LOCAL_PHOTOROOT
else
mv -v $FLASH_PHOTOROOT${dir}/* $LOCAL_PHOTOROOT${dir}
rmdir -v $FLASH_PHOTOROOT${dir}
fi
chown -R matthew:matthew $LOCAL_PHOTOROOT${dir}
done
umount $MOUNTPOINT



  • Search
  • You are currently browsing the matthewcarroll.ca archives for the day Sunday, September 4th, 2005.

  • Meta

  • Old Browser

    It seems you are using an old web browser (e.g. Internet Explorer 5 or below). This is a security risk to you, since Microsoft no longer releases updates for old versions of Internet Explorer. Also, note that this site is designed to modern internet standards, and the layout may appear strange or plain in older browsers. All the content is still accessible to you, but I strongly recommend you upgrade to a modern, safe, standards-complient browser, such as Firefox. For more information on getting the best experience surfing the web, see browsehappy.com.