Better file transfer
This commit is contained in:
9
gphoto-backup.sh
Normal file → Executable file
9
gphoto-backup.sh
Normal file → Executable file
@@ -6,6 +6,7 @@ STORAGE_MOUNT_POINT="/home/pi/BACKUP"
|
|||||||
# Set the ACT LED to heartbeat
|
# Set the ACT LED to heartbeat
|
||||||
sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
|
sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
|
||||||
|
|
||||||
|
# Create the target directory if it doesn't exist
|
||||||
if [ ! -d "$STORAGE_MOUNT_POINT" ]; then
|
if [ ! -d "$STORAGE_MOUNT_POINT" ]; then
|
||||||
mkdir $STORAGE_MOUNT_POINT
|
mkdir $STORAGE_MOUNT_POINT
|
||||||
fi
|
fi
|
||||||
@@ -21,12 +22,12 @@ done
|
|||||||
# Set the ACT LED to blink at 500ms to indicate that the camera has been detected
|
# Set the ACT LED to blink at 500ms to indicate that the camera has been detected
|
||||||
sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on"
|
sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on"
|
||||||
|
|
||||||
# Switch to STORAGE_MOUNT_POINT and create a directory with current date as its name
|
# Switch to STORAGE_MOUNT_POINT and transfer files from the camera
|
||||||
|
# Rename the transferred files using the YYYYMMDD-HHMMSS format
|
||||||
cd $STORAGE_MOUNT_POINT
|
cd $STORAGE_MOUNT_POINT
|
||||||
gphoto2 --new
|
gphoto2 --get-all-files --skip-existing --filename=%Y%m%d-%H%M%S.%C
|
||||||
# Rename files using ExifTool based on EXIF date and time data
|
|
||||||
exiftool -r -d %Y%m%d-%H%M%S.%%e "-FileName<DateTimeOriginal" .
|
|
||||||
# Turn off the ACT LED to indicate that the backup is completed
|
# Turn off the ACT LED to indicate that the backup is completed
|
||||||
sudo sh -c "echo 0 > /sys/class/leds/led0/brightness"
|
sudo sh -c "echo 0 > /sys/class/leds/led0/brightness"
|
||||||
|
|
||||||
# Shutdown
|
# Shutdown
|
||||||
shutdown -h now
|
shutdown -h now
|
||||||
|
|||||||
Reference in New Issue
Block a user