Jump to content
Sign in to follow this  
RANA

Read all particular text files and compare the size

Recommended Posts

Why are you trying complicated things ?
Only 3 lines to include in the previous code

#include <GUIConstantsEx.au3>
#include <File.au3>

$gui = GUICreate("Form1")
$listview = GUICtrlCreateListView("file name|Size in byte|difference", 10, 10, 300, 200)
GUISetState()

$myfolder = "test_folder"  ; full path of the folder containing txt files
$csv = "file name;Size in byte;difference" & @crlf

$files = _FileListToArray($myfolder, "*.txt", 1)   
For $i = $files[0] to 1 step -1
   $name = $files[$i]
   $size = FileGetSize($myfolder & "\" & $files[$i])
   $diff = ($i > 1) ? $size - FileGetSize($myfolder & "\" & $files[$i-1]) : "---"
   GUICtrlCreateListViewItem($name & "|" & $size & "|" & $diff, $listview)
   $csv &= $name & ";" & $size & ";" & $diff & @crlf
Next
FileWrite(@scriptdir & "\mycsv.csv", $csv)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

Try this (just a basis)

#include <GUIConstantsEx.au3>
#include <File.au3>

$gui = GUICreate("Form1")
$listview = GUICtrlCreateListView("file name|Size in byte|difference", 10, 10, 300, 200)
GUISetState()

$myfolder = "test_folder"  ; full path of the folder containing txt files

$files = _FileListToArray($myfolder, "*.txt", 1)   
For $i = $files[0] to 1 step -1
   $name = $files[$i]
   $size = FileGetSize($myfolder & "\" & $files[$i])
   $diff = ($i > 1) ? $size - FileGetSize($myfolder & "\" & $files[$i-1]) : "---"
   GUICtrlCreateListViewItem($name & "|" & $size & "|" & $diff, $listview)
Next


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Thanks Mikell

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...