-
Notifications
You must be signed in to change notification settings - Fork 0
/
print-ebooks-library-stats.sh
executable file
·35 lines (30 loc) · 1.16 KB
/
print-ebooks-library-stats.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -e
epubcount=$(find /mnt/ebooks -type f -iname '*.epub' | wc -l)
pdfcount=$(find /mnt/ebooks -type f -iname '*.pdf' | wc -l)
mobicount=$(find /mnt/ebooks -type f -iname '*.mobi' | wc -l)
txtcount=$(find /mnt/ebooks -type f -iname '*.txt' | wc -l)
rtfcount=$(find /mnt/ebooks -type f -iname '*.rtf' | wc -l)
doccount=$(find /mnt/ebooks -type f -iname '*.doc' | wc -l)
chmcount=$(find /mnt/ebooks -type f -iname '*.chm' | wc -l)
opfcount=$(find /mnt/ebooks -type f -iname '*.opf' | wc -l)
cbzcount=$(find /mnt/ebooks -type f -iname '*.cbz' | wc -l)
filecount=$(find /mnt/ebooks -type f | wc -l)
bookscount=$(($epubcount + $pdfcount + $mobicount + $rtfcount + $doccount + $txtcount + $opfcount + $chmcount))
echo "** eBooks Library Stats"
echo -e
echo "File Types:"
echo "EPUB count: $epubcount"
echo "PDF count: $pdfcount"
echo "MOBI count: $mobicount"
echo "TXT count: $txtcount"
echo "RTF count: $rtfcount"
echo "DOC count: $doccount"
echo "CHM count: $chmcount"
echo "OPF count: $opfcount"
echo "CBZ count: $cbzcount"
echo "Total books count: $bookscount"
echo "Total file count: $filecount"
echo -e
echo "Total size of ebooks library:"
du -h /mnt/ebooks | tail -n1