Jump to content

larger file


masvil
 Share

Recommended Posts

$file = 'none found'
$size = 0
$path = 'c:\windows\'  ;your path here
$first = FileFindFirstFile($path & '*.*')

While 1
    $next = FileFindNextFile($first)
    If @error Then ExitLoop
    If StringInStr(FileGetAttrib($path & $next), 'D') Then ContinueLoop
    $check = FileGetSize($path & $next)
    If $check > $size Then
        $size = $check
        $file = $path & $next
    EndIf
WEnd

MsgBox(0, '', _
        'File is:  ' & $file & @CRLF & _
        'Size is:  ' & StringFormat('%.2f', $size / 1048576) & 'MB')

Edited by xcal
Link to comment
Share on other sites

It works great, thanx :P

I was playing with following, but it doesn't return size, so your is better for me.

$dir = @WindowsDir
RunWait(@ComSpec & ' /c dir "' & $dir & '" /B /D /O-S /A RASH>dir.txt',@ScriptDir, @SW_HIDE)
$larger = FileReadLine("dir.txt")
FileDelete(@ScriptDir & "\dir.txt")
MsgBox(1,"","larger file is: " & $larger)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...