salix/storage/image/reestructure.sh

16 lines
498 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}')
2023-12-15 20:55:38 +00:00
echo $image
echo ${hash:2:2}/${hash:0:2}
2023-11-28 13:51:34 +00:00
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