salix/storage/image/move.sh

20 lines
679 B
Bash
Raw Normal View History

2023-11-28 13:51:34 +00:00
#!/bin/bash
2023-12-18 10:33:28 +00:00
DIR_LEVELS=2
2023-11-28 13:51:34 +00:00
for collection in */ ; do
for size in "$collection"*/ ; do
for image in "$size"* ; do
if [ -f "$image" ]; then
fileName=$(basename "$image")
imageName="${fileName%.*}"
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
2023-12-18 10:33:28 +00:00
first=$(echo "$hash" | cut -c"$inicio"-"$DIR_LEVELS")
second=$(echo "$hash" | cut -c"$DIR_LEVELS"-"$fin")
path=$(dirname "$image")/${first}/${second}
mkdir -p $path
ln -s "$image" "$fileName"
mv $image $path/$fileName
fi
2023-11-28 13:51:34 +00:00
done
done
done