feat: improved pdf page count script

This commit is contained in:
2026-07-26 14:47:18 +02:00
parent ecaab3e673
commit 08c3d41ff2
+8 -4
View File
@@ -4,13 +4,17 @@ if [[ -n $1 ]]; then
echo "File contains $(pdfinfo $1 | awk '/^Pages:/ {print $2}') pages"
else
total=0
count=0
for file in *.pdf; do
count=$(pdfinfo $file | awk '/^Pages:/ {print $2}')
echo "$count pages in $file"
total=$(($total + count))
count_file=$(pdfinfo $file | awk '/^Pages:/ {print $2}')
echo "$count_file pages in $file"
total=$(($total + count_file))
count=$((count + 1))
done
echo "
Total page count is $total
-> Total page count: $total
-> Total files: $count
-> Median: $(($total / $count))
"
fi