Byte Conversion
Posted: 01 Mar 2012 21:01
Hello,
I'm working on a batch file that backs up data and I want the file to show the current file size in bytes, kilobytes, megabytes, and gigabytes. I know how to get the file size in bytes, but converting it is the problem. I know I can do [size in bytes]/1024 to find the size in kilobytes, but this doesn't always work due to 32-bit floating point limitations (i.e. doing "set /a var=1564231685254/1024" yields this error: Invalid number. Numbers are limited to 32-bits of precision).
Is there any way to get around this?
Thanks in advance!
I'm working on a batch file that backs up data and I want the file to show the current file size in bytes, kilobytes, megabytes, and gigabytes. I know how to get the file size in bytes, but converting it is the problem. I know I can do [size in bytes]/1024 to find the size in kilobytes, but this doesn't always work due to 32-bit floating point limitations (i.e. doing "set /a var=1564231685254/1024" yields this error: Invalid number. Numbers are limited to 32-bits of precision).
Is there any way to get around this?
Thanks in advance!