refs #5576 perf update scripts sh
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b1d5a62aa5
commit
f4f2333d36
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
DIR_LEVELS=2
|
||||||
for collection in */ ; do
|
for collection in */ ; do
|
||||||
for size in "$collection"*/ ; do
|
for size in "$collection"*/ ; do
|
||||||
for image in "$size"* ; do
|
for image in "$size"* ; do
|
||||||
|
@ -7,7 +7,9 @@ for collection in */ ; do
|
||||||
fileName=$(basename "$image")
|
fileName=$(basename "$image")
|
||||||
imageName="${fileName%.*}"
|
imageName="${fileName%.*}"
|
||||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||||
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
|
first=$(echo "$hash" | cut -c"$inicio"-"$DIR_LEVELS")
|
||||||
|
second=$(echo "$hash" | cut -c"$DIR_LEVELS"-"$fin")
|
||||||
|
path=$(dirname "$image")/${first}/${second}
|
||||||
mkdir -p $path
|
mkdir -p $path
|
||||||
ln -s "$image" "$fileName"
|
ln -s "$image" "$fileName"
|
||||||
mv $image $path/$fileName
|
mv $image $path/$fileName
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
MIN_DIR_LEVELS=0
|
||||||
|
DIR_LEVELS=2
|
||||||
|
START=1
|
||||||
|
END=3
|
||||||
# Directorio que contiene las carpetas con las fotos
|
# Directorio que contiene las carpetas con las fotos
|
||||||
directorio_principal=$1
|
MAIN_DIR=$1
|
||||||
|
|
||||||
# Iterar a través de cada carpeta en el directorio principal
|
# Iterar a través de cada carpeta en el directorio principal
|
||||||
for image in "$directorio_principal"/*; do
|
for image in "$MAIN_DIR"/*; do
|
||||||
# Verificar si es un directorio
|
# Verificar si es un directorio
|
||||||
# if [ -d "$image" ]; then
|
|
||||||
# Iterar a través de cada imagen en la subcarpeta
|
# Iterar a través de cada imagen en la subcarpeta
|
||||||
# for image in "$image"/*.png; do
|
|
||||||
# Verificar si es un archivo
|
# Verificar si es un archivo
|
||||||
if [ -f "$image" ]; then
|
if [ -f "$image" ]; then
|
||||||
# Obtener el nombre de la imagen
|
# Obtener el nombre de la imagen
|
||||||
fileName=$(basename "$image")
|
fileName=$(basename "$image")
|
||||||
imageName="${fileName%.*}"
|
imageName="${fileName%.*}"
|
||||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||||
echo "$(dirname "$image")/${hash:0:2}/${hash:2:2}"
|
first=$(echo "$hash" | cut -c"$START"-"$DIR_LEVELS")
|
||||||
|
echo "$first"
|
||||||
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
|
second=$(echo "$hash" | cut -c"$DIR_LEVELS"-"$END")
|
||||||
|
echo "$second"
|
||||||
|
path=$(dirname "$image")/${first}/${second}
|
||||||
mkdir -p $path
|
mkdir -p $path
|
||||||
# Crear un enlace simbólico en la carpeta principal
|
# Crear un enlace simbólico en la carpeta principal
|
||||||
mv $image $path/$fileName
|
mv $image $path/$fileName
|
||||||
ln -s "$image" "$1/$fileName"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
# done
|
# done
|
||||||
|
|
Loading…
Reference in New Issue