Page 1 of 1

Check File Size Properties

Posted: 08 Feb 2023 19:45
by xiro
Is it possible to view folder size properties with a right click using a batch file for comparison to folders? I am researching it now what key phrase should I type to find nice result for this project?


Image

Where it could open the right click and show me the properties window is this possible?

Re: Check File Size Properties

Posted: 21 Feb 2023 01:03
by xiro
I guess this is not possible sad. Tsk!

Re: Check File Size Properties

Posted: 25 Feb 2023 08:47
by Sponge Belly
Hi Xiro! :)

Please read this Microsoft Community thread.

HTH!

- SB

Re: Check File Size Properties

Posted: 06 Mar 2023 20:14
by xiro
Sponge Belly wrote:
25 Feb 2023 08:47
Hi Xiro! :)

Please read this Microsoft Community thread.

HTH!

- SB
Haha..... How to do that with a batch file to choose a folder then know their sizes by just clicking the .bat file and the properties window would show up and I can now Identify if it both folder are of same size :)

Re: Check File Size Properties

Posted: 06 Mar 2023 20:14
by xiro
xiro wrote:
06 Mar 2023 20:14
Sponge Belly wrote:
25 Feb 2023 08:47
Hi Xiro! :)

Please read this Microsoft Community thread.

HTH!

- SB
Haha..... How to do that with a batch file to choose a folder then know their sizes by just clicking the .bat file and the properties window would show up and I can now Identify if it both folder are of same size :)

Re: Check File Size Properties

Posted: 06 Mar 2023 23:22
by ShadowThief
I don't understand why you need this. Just right-click the first folder and select Properties, and then right-click the second folder and select Properties. There's no need to bring a script into this at all based on what you've described so far.

Re: Check File Size Properties

Posted: 07 Mar 2023 02:12
by xiro
ShadowThief wrote:
06 Mar 2023 23:22
I don't understand why you need this. Just right-click the first folder and select Properties, and then right-click the second folder and select Properties. There's no need to bring a script into this at all based on what you've described so far.
That is for automation where I don't need to bother with any right click and I will attach that fragment code to the script that I have created in automating the backup of the company database :)

The sole purpose for the right-click function is that I could easily see if the backup has the same size as the source file just by looking at it early in the morning when I arrive. :D

Re: Check File Size Properties

Posted: 07 Mar 2023 22:30
by ShadowThief
If all you need is the size of some folder, that's been posted on here before: viewtopic.php?t=9615

Re: Check File Size Properties

Posted: 08 Mar 2023 07:55
by xiro
ShadowThief wrote:
07 Mar 2023 22:30
If all you need is the size of some folder, that's been posted on here before: viewtopic.php?t=9615
I will try this thank you for your assistance pal😐

Re: Check File Size Properties

Posted: 08 Mar 2023 07:55
by xiro
ShadowThief wrote:
07 Mar 2023 22:30
If all you need is the size of some folder, that's been posted on here before: viewtopic.php?t=9615
I will try this thank you for your assistance pal😐

Re: Check File Size Properties

Posted: 10 Mar 2023 01:24
by xiro
@echo off
setlocal

set "folder1=C:"
set "folder2=E:"

set "size1="
set "size2="

for /f "tokens=1,2 delims=: " %%a in ('robocopy "%folder1%" "%folder1%" /L /S /NJH /BYTES /FP /NC /NDL /NFL /TS /XJ /R:0 /W:0') do if /i "%%a"=="Bytes" set "size1=%%b"

for /f "tokens=1,2 delims=: " %%a in ('robocopy "%folder2%" "%folder2%" /L /S /NJH /BYTES /FP /NC /NDL /NFL /TS /XJ /R:0 /W:0') do if /i "%%a"=="Bytes" set "size2=%%b"

if "%size1%"=="" (echo Error: Unable to get size for folder "%folder1%" & goto :EOF)
if "%size2%"=="" (echo Error: Unable to get size for folder "%folder2%" & goto :EOF)

echo Folder 1: %folder1%
echo Size: %size1% bytes
echo.
echo Folder 2: %folder2%
echo Size: %size2% bytes
echo.

if %size1% GTR %size2% (
echo Folder 1 is larger than Folder 2
) else if %size1% LSS %size2% (
echo Folder 2 is larger than Folder 1
) else (
echo Folder 1 and Folder 2 are the same size
)

Not that accurate why?

Re: Check File Size Properties

Posted: 15 Mar 2023 23:49
by xiro
gulshan212 wrote:
14 Mar 2023 22:45
Hello this is Gulshan Negi
Well, to view folder size properties with a right click using a batch file, you can create a batch script that uses the Windows PowerShell command-line interface. To find resources and information related to this topic, you can search for phrases like "batch script to get folder size" or "Windows PowerShell folder size". You can also check online forums and communities like Stack Overflow and Microsoft Tech Community for helpful tips and guidance.
I hope you are clear now.
Thanks
Thanks cool.

Re: Check File Size Properties

Posted: 17 Mar 2023 00:48
by xiro
I have now the sample script

$folder1 = Get-ChildItem -Path "E:\XXX\Videos" -Recurse | Measure-Object -Property Length -Sum
$folder2 = Get-ChildItem -Path "F:\NEWLYCREATED FOLDER" -Recurse | Measure-Object -Property Length -Sum

if ($folder1.Sum -gt $folder2.Sum) {
Write-Host "Folder1 is larger than Folder2 by $(($folder1.Sum / 1MB).ToString('N2')) MB"
} elseif ($folder1.Sum -lt $folder2.Sum) {
Write-Host "Folder2 is larger than Folder1 by $(($folder2.Sum / 1MB).ToString('N2')) MB"
} else {
Write-Host "Folder1 and Folder2 are the same size"
}

In the folder2 how to check the new folder created within this day? Am I needed to %NewFolder%? How? Heheh Folder2 is a newly created folder, not an old folder.

The above script works only if the folder was already created, but how about a daily folder creation (Folder2) then checking the folder size within the same day is not possible because that is another folder name that is only the lacking piece and boom its done :)

Any help is acceptable