Skip to content

Instantly share code, notes, and snippets.

@hdznrrd
Created August 7, 2011 15:21
Show Gist options
  • Save hdznrrd/1130453 to your computer and use it in GitHub Desktop.
Save hdznrrd/1130453 to your computer and use it in GitHub Desktop.
sort .NEF files into dated folders
#!/bin/bash
# for all Nikon raw files in thhe folder
for file in *.NEF; do
# get create date of file
date=$(stat -c %y "$file" | awk '{print $1}')
# if there's no folder with this date yet, create one
if [[ ! -d "$date" ]]; then
mkdir "$date"
echo -n "d"
fi
# move photo
mv "$file" "$date/"
echo -n "."
# check if there's a Bibble5 metadata file already
# if yes, move it as well
if [[ -f "$file.xmp" ]]; then
mv "$file.xmp" "$date/"
echo -n ":"
fi
done
echo ">"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment