From c3851f847f379bb08da1192c811a6cd863e6a87c Mon Sep 17 00:00:00 2001 From: Jonathan Blake Date: Sun, 28 Oct 2012 01:16:34 +0000 Subject: [PATCH] altered the script to list all formats in PmWiki page-text variable form git-svn-id: https://projectaon.org/data/trunk@2152 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- common/scripts/list-file-sizes.sh | 57 +++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/common/scripts/list-file-sizes.sh b/common/scripts/list-file-sizes.sh index 1b92073..b1989d2 100755 --- a/common/scripts/list-file-sizes.sh +++ b/common/scripts/list-file-sizes.sh @@ -1,10 +1,53 @@ #!/bin/sh -# List the file sizes of a book, should be executed in a parent directory of -# all the files to be found +# list book file sizes in page-text directive form, should be executed in a +# parent directory of all the files to be found # Usage: list-file-sizes.sh bookcode -du -h `find . -path "*xhtml-less-simple*$1"` -find . -name "$1.*" \ - | grep -v "\.svn\|\.xml\|\.dot\|\.log" \ - | xargs ls -lh \ - | awk '{print $5 "\t" $9}' +list_file_size () { + size='' + if [ -f "$2" ]; then + size=`ls -lh $2 \ + | awk '{print $5}' \ + | sed -e 's/\([MK]\)$/ {\1iB}/'` + fi + echo "(:$1:$size:)" + + return 0 +} + +list_dir_size () { + size='' + if [ -d "$2" ]; then + size=`du -h $2 \ + | awk '{print $1}' \ + | sed -e 's/\([MK]\)$/ {\1iB}/'` + fi + echo "(:$1:$size:)" + + return 0 +} + +#### + +list_file_size xhtml-zip-size \ + `find . -path "*xhtml/*$1.zip"` +list_dir_size xhtml-less-simple-size \ + `find . -path "*xhtml-less-simple*$1"` +list_file_size xhtml-less-simple-zip-size \ + `find . -path "*xhtml-less-simple/*$1.zip"` +list_file_size xhtml-simple-size \ + `find . -path "*xhtml-simple/*$1.htm"` +list_file_size xhtml-simple-zip-size \ + `find . -path "*xhtml-simple/*$1.zip"` +list_file_size pdf-size \ + `find . -name "$1.pdf"` +list_file_size epub-size \ + `find . -name "$1.epub"` +list_file_size mobi-size \ + `find . -name "$1.mobi"` +list_file_size fb2-size \ + `find . -name "$1.fb2"` +list_file_size pdb-size \ + `find . -name "$1.pdb"` +list_file_size lrf-size \ + `find . -name "$1.lrf"` -- 2.34.1