Created
December 12, 2021 15:32
-
-
Save goeland86/b95060b3b3f5d7331ff06bb57db871c7 to your computer and use it in GitHub Desktop.
Import script to sort out Canon CR3 camera files into the same import structure Shotwell does until CR3 support is merged in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -ne 2 ]]; then | |
echo "This script expects 2 arguments: " | |
echo " - the import folder, where images to import are located" | |
echo " - the target folder, where images to import should be stored" | |
echo "Your current execution provides neither." | |
exit 1 | |
fi | |
IMPORT_BASE=$1 | |
TARGET_BASE=$2 | |
IMAGE_LIST=(`find ${IMPORT_BASE} | grep -i -E 'CR3|CR2|JPEG|JPG|MOV'`) | |
for image in "${IMAGE_LIST[@]}"; do | |
path=$(date -r ${image} '+%Y/%m/%d') | |
if [[ ! -d "${TARGET_BASE}/${path}" ]]; then | |
mkdir -p "${TARGET_BASE}/${path}" | |
fi | |
filename=$(basename $image) | |
echo "copying $image to ${TARGET_BASE}/${path}/${filename}" | |
cp ${image} ${TARGET_BASE}/${path}/${filename} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment