salix/storage/image/reestructure.sh

14 lines
433 B
Bash
Raw Normal View History

2023-11-28 13:51:34 +00:00
#!/bin/bash
for collection in */ ; do
for size in "$collection"*/ ; do
for image in "$size"* ; do
fileName=$(basename "$image")
imageName="${fileName%.*}"
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
mkdir -p $(dirname "$image")/${hash:2:2}/${hash:0:2}
ln -s $image $(dirname "$image")/${hash:2:2}/${hash:0:2}/$fileName
done
done
done