I am trying to create a script to write an XML file for Apple's ITMSP Transporter files for uploading metadata to the App Store. Requirements for screenshots are filename, MD5 checksum and filesize in bytes.
MD5 checksum is easy and be can be retrieved with md5 -q image.png
I am however having a hard time trying to get the byte size of the image file. If I use du -k image.png
command, it returns the size rounded up in kilo bytes. So for example if the actual size is 5722 bytes, du
will return 8 (as in 8K or 8192 bytes) which is not correct. And the default for du
is in 512 byte chunks but still rounds the value up (so it will return 16 instead of 8).
I am running Lion OSX 10.7.4.
question from:
https://stackoverflow.com/questions/18689592/how-to-get-file-size-in-bytes-from-shell-script 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…