LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   photo upload script (https://www.linuxquestions.org/questions/linux-software-2/photo-upload-script-72920/)

mohapi 07-15-2003 10:21 AM

photo upload script
 
I currently mount the camera [/dev/sda1], then /mnt/camera, then cp /whatever/flicks to /data3/PHOTOS and view them with gimp.

Here is a script I've been given to upload photos from my Olympus C-4000 to my RH 9 machine;
----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
It uses jhead to get the date/time of the
photo and rename it:

#!/bin/bash
# A script to copy photographs from a Fuji finepix camera mounted
# as a vfat volume via USB and linux SCSI emulation /dev/sda1
# with the user option.

MOUNT_POINT=/local/camera

# Get the single command line parameter which should a non-existent
directory
new_dir=$1

if [ -z $new_dir ]
then
echo "Usage: $0 new_directory_name";
exit -1;
fi

# Prevent overwriting of existing directories
if [ -f $new_dir -o -d $new_dir ]
then
printf "That directory exists already - please rename it or
choose a new name for this one\n";
exit -1 ;
fi

mounted=`grep ${MOUNT_POINT} /etc/mtab | wc -c`
if [ $mounted -gt 0 ]
then
umount ${MOUNT_POINT};
fi
mount ${MOUNT_POINT}
printf "Starting the copying now\n";
time cp -pr ${MOUNT_POINT}/dcim/100_fuji $new_dir
copy_count=`ls $new_dir | wc -l`;
printf "Copied $copy_count files to $new_dir\n";
printf "Renaming files\n";

jhead -ft -nf -c $new_dir/*.jpg;

# Clear up after the copying
umount ${MOUNT_POINT}
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
Do I change MOUNT_POINT to = /data3/PHOTOS as it is where I put photos on my system? Also, what do I name the script and where should I put it? Does it go in /bin? I've never written or used a script before today.
Thanks

:study:


All times are GMT -5. The time now is 10:17 PM.