Good afternoon,
I have been struggling with this and would appreciate some help please!
I have two compressed [zipped] folders on the desktop that get generated via a batch file. I would like a script [I know that I can right-click them and select properties to find out the information but I don't want to do it with a script] to give me the actual Size: and the Size on disk: as megabytes. I found some code on the Internet and have tried to adapt it. These are my questions please...
[1] In the script below it is for a desktop .log file [for testing purposes]. How can I change this to the compressed [zipped] folder name, also on the desktop?
[2] For the actual Size: I can't get it converted to megabytes as two decimal places.
[3] I have converted the bytes to megabytes for Size on disk: but how can I get it to show as two decimal places?
Here is the code...
Any help will be greatly appreciated.
Thanks in advance.
I have been struggling with this and would appreciate some help please!
I have two compressed [zipped] folders on the desktop that get generated via a batch file. I would like a script [I know that I can right-click them and select properties to find out the information but I don't want to do it with a script] to give me the actual Size: and the Size on disk: as megabytes. I found some code on the Internet and have tried to adapt it. These are my questions please...
[1] In the script below it is for a desktop .log file [for testing purposes]. How can I change this to the compressed [zipped] folder name, also on the desktop?
[2] For the actual Size: I can't get it converted to megabytes as two decimal places.
[3] I have converted the bytes to megabytes for Size on disk: but how can I get it to show as two decimal places?
Here is the code...
Code:
@echo off
setlocal
for %%I in (CBS.log) do (
set "fs=%%~zI"
for /f %%J in (
'wmic volume where "driveletter='%%~dI'" get blocksize /value'
) do 2>nul set /a %%J
)
echo Size [Bytes]: %fs%
echo Size [MB's]: %fs%
set /a ondisk = ((fs-1)/blocksize+1) * blocksize
set /a ondisk1 = ((fs-1)/blocksize+1) * blocksize / 1024 / 1024
echo.
echo Size on disk [Bytes]: %ondisk%
echo Size on disk [MB's]: %ondisk1%
echo.
pause
Any help will be greatly appreciated.
Thanks in advance.