salix/storage/image/move.sh

16 lines
459 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}')
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
mkdir -p $path
mv $image $path/$fileName
ln -s $path/$fileName $fileName
done
done
done