X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Flist-file-sizes.sh;h=50be4ed6084c388c25c31dd6836cf3dbe706c252;hp=977f0bcec582aa5999a8654b05cd94c5c5b43823;hb=600bebceef75b28a2e0a4723e09df73c179d66a8;hpb=3124a0a27857fc058d8e233679fe56dced594292 diff --git a/common/scripts/list-file-sizes.sh b/common/scripts/list-file-sizes.sh index 977f0bc..50be4ed 100755 --- a/common/scripts/list-file-sizes.sh +++ b/common/scripts/list-file-sizes.sh @@ -1,10 +1,55 @@ #!/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" \ - | 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"` +list_file_size svg_size \ + `find . -name "$1.svgz"`