blob: b72c1697c9d17e53f7430bc61059ef0a46686111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/usr/bin/env bash
readonly PAPEDIR="$HOME/pictures/wallpapers"
main() {
for s in "$@"
do
local format="$(identify -format "%m" "$s" | awk '{ print(tolower($0)) }')"
local resolution="$(identify -format "%wx%h" "$s")"
local hash="$(sha1sum "$s" | awk '{ print $1 }')"
local destination="$PAPEDIR/$resolution/$hash.$format"
mkdir -pv -- "$PAPEDIR/$resolution"
printf "Importing %s to %s\n" "$s" "$destination"
mv -- "$s" "$destination"
done
}
main "$@"
|