Created
July 18, 2020 15:50
-
-
Save sk22/9f3ad919aecee2db4b87dceec0208864 to your computer and use it in GitHub Desktop.
Creates photo album by linking files with a certain keyword in filename/path
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/sh | |
# expected file structure: | |
# 2018/ | |
# 2019/ | |
# ... | |
# albums/ | |
# create-album-by-keyword.sh | |
# working directory must be /albums! | |
if [ -z "$1" ]; then | |
echo "Parameter expected" | |
exit 1 | |
fi | |
folder="${2:-$1}" | |
echo keyword $1 | |
echo folder $folder | |
mkdir $folder | |
# create hard links for each file (will also work with smb shares) | |
find ../ -path "*$1*" -type f -not -path "../albums/*" -exec ln {} ./$folder \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment