Article pages now have a discussion option at the bottom (moderated/captcha, but no registration needed)

Show size of a file

Keywords: file,size,filesize,echo
Contributor: Frank Lazzarini

This is a simple snippet to echo the size of a file in bytes.

#!/bin/bash
FILENAME=/home/heiko/dummy/packages.txt
FILESIZE=$(wc -c < "$FILENAME")
# non standard way (GNU stat): FILESIZE=$(stat -c%s "$FILENAME")

echo "Size of $FILENAME = $FILESIZE bytes."

Discussion

Enter your comment
 
snipplets/filesize.txt · Last modified: 2009/10/02 06:24 by thebonsai
GNU Free Documentation License 1.2
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0