feat: improved pdf page count script
This commit is contained in:
+13
-9
@@ -1,16 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
echo "File contains $(pdfinfo $1 | awk '/^Pages:/ {print $2}') pages"
|
||||
echo "File contains $(pdfinfo $1 | awk '/^Pages:/ {print $2}') pages"
|
||||
else
|
||||
total=0
|
||||
for file in *.pdf; do
|
||||
count=$(pdfinfo $file | awk '/^Pages:/ {print $2}')
|
||||
echo "$count pages in $file"
|
||||
total=$(($total + count))
|
||||
done
|
||||
total=0
|
||||
count=0
|
||||
for file in *.pdf; do
|
||||
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
|
||||
echo "
|
||||
-> Total page count: $total
|
||||
-> Total files: $count
|
||||
-> Median: $(($total / $count))
|
||||
"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user