fix: Correct some errors
This commit is contained in:
parent
43cb4e8810
commit
a42824cc06
1 changed files with 12 additions and 10 deletions
|
@ -10,10 +10,13 @@ loop() {
|
||||||
#Parse each file in folder
|
#Parse each file in folder
|
||||||
folderescaped=${folder////\\/}
|
folderescaped=${folder////\\/}
|
||||||
ky=$(echo "${y}" | sed -e "s/${folderescaped}/https:\/\/${url}/g" -e "s/-[0-9]*\..*\$//g")
|
ky=$(echo "${y}" | sed -e "s/${folderescaped}/https:\/\/${url}/g" -e "s/-[0-9]*\..*\$//g")
|
||||||
f=$(sudo mariadb "${db}" -N -B -q -e "select photo from contact where photo like '${ky}%' limit 1")
|
f=$(mariadb "${db}" -N -B -q -e "select photo from contact where photo like '${ky}%' limit 1")
|
||||||
if [[ $? -eq 0 && -z ${f} && -f ${y} ]]; then
|
if [[ $? -eq 0 && -z ${f} && -f ${y} ]]; then
|
||||||
ls -lh "${y}"
|
( ls -lh "${y}" && rm -rf "${y}" ) &
|
||||||
sudo rm -rf "${y}"
|
if [[ $(jobs -r -p | wc -l) -ge $(($(getconf _NPROCESSORS_ONLN) * 2)) ]]; then
|
||||||
|
wait -n
|
||||||
|
fi
|
||||||
|
|
||||||
d=$((d + 1))
|
d=$((d + 1))
|
||||||
fi
|
fi
|
||||||
#printf "\rPhotos: %s\tFolder %s\tEntry %s " "$d" "$n" "$m"
|
#printf "\rPhotos: %s\tFolder %s\tEntry %s " "$d" "$n" "$m"
|
||||||
|
@ -24,12 +27,11 @@ loop() {
|
||||||
date
|
date
|
||||||
#Go to the Friendica installation
|
#Go to the Friendica installation
|
||||||
cd "${folderavatar}" || exit
|
cd "${folderavatar}" || exit
|
||||||
#let "indexlength=37+${#url}"
|
indexlength=$((49 + ${#url}))
|
||||||
((indexlength = 49 + ${#url}))
|
mariadb "${db}" -e "alter table contact add index if not exists photo_index (photo(${indexlength}))"
|
||||||
sudo mariadb "${db}" -e "alter table contact add index if not exists photo_index (photo(${indexlength}))"
|
|
||||||
n=0
|
n=0
|
||||||
d=0
|
d=0
|
||||||
sudo find "${folderavatar}" -depth -mindepth 1 -maxdepth 1 -type d | while read -r x; do
|
find "${folderavatar}" -depth -mindepth 1 -maxdepth 1 -type d | while read -r x; do
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
#If the directory still exists
|
#If the directory still exists
|
||||||
if [[ -d "${x}" ]]; then
|
if [[ -d "${x}" ]]; then
|
||||||
|
@ -43,10 +45,10 @@ sudo find "${folderavatar}" -depth -mindepth 1 -maxdepth 1 -type d | while read
|
||||||
if [[ $(jobs -r -p | wc -l) -ge $(($(getconf _NPROCESSORS_ONLN) * 2)) ]]; then
|
if [[ $(jobs -r -p | wc -l) -ge $(($(getconf _NPROCESSORS_ONLN) * 2)) ]]; then
|
||||||
wait -n
|
wait -n
|
||||||
fi
|
fi
|
||||||
#done < <(sudo find "${x}" -type f -mtime -8)
|
#done < <(find "${x}" -type f -mtime -8)
|
||||||
done < <(sudo find "${x}" -type f)
|
done < <(find "${x}" -type f)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
sudo mariadb "${db}" -e "alter table contact drop index photo_index"
|
mariadb "${db}" -e "alter table contact drop index photo_index"
|
||||||
date
|
date
|
||||||
|
|
Loading…
Add table
Reference in a new issue