I have scripted MaxSize.bat to display the fully qualified file name and file size of the largest file in a drive or folder.
The syntax for using MaxSize.bat is:
MaxSize DriveOrFolder \[non-blank for sub-folders\]
Where DriveOrFolder is the drive letter of folder path to search, like C: or C:\folder or "C:\Documents and Settings\Jerry\My Documents", and any non-blank second parameter will cause all sub-folders to be searched.
MaxSize.bat contains:
@echo off if \{%1\}\{\} @echo Syntax: MaxSize Drive: \[non-blank for sub-folders\]&goto :EOF setlocal ENABLEDELAYEDEXPANSION set /a size=0 set file="NONE" if not \{%2\}
\{\} set sub= /s pushd %1 set folder=%1 set folder=%folder:"=% for /f "Tokens=*" %%a in ('dir %1 /b%sub%') do ( if %%~za GTR !size! set size=%%~za&set file=%%a ) set work=%file:\=% if "%work%" EQU "%File%" set file=%folder%\%file% @echo "%file%" %size% popd endlocal
0 comments
Hide comments