Check File Size Properties
Moderator: DosItHelp
Check File Size Properties
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?
Where it could open the right click and show me the properties window is this possible?
Where it could open the right click and show me the properties window is this possible?
Re: Check File Size Properties
I guess this is not possible sad. Tsk!
-
- Posts: 231
- Joined: 01 Oct 2012 13:32
- Location: Ireland
- Contact:
Re: Check File Size Properties
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 sizeSponge Belly wrote: ↑25 Feb 2023 08:47Hi Xiro!
Please read this Microsoft Community thread.
HTH!
- SB
Re: Check File Size Properties
xiro wrote: ↑06 Mar 2023 20:14Haha..... 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 sizeSponge Belly wrote: ↑25 Feb 2023 08:47Hi Xiro!
Please read this Microsoft Community thread.
HTH!
- SB
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Check File Size Properties
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
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 databaseShadowThief wrote: ↑06 Mar 2023 23:22I 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.
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.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Check File Size Properties
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
I will try this thank you for your assistance palShadowThief wrote: ↑07 Mar 2023 22:30If 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
I will try this thank you for your assistance palShadowThief wrote: ↑07 Mar 2023 22:30If 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
@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?
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
Thanks cool.gulshan212 wrote: ↑14 Mar 2023 22:45Hello 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
Re: Check File Size Properties
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
$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