Jump to content

How to list all sub folder names & sizes in text file?


mega128
 Share

Recommended Posts

I am using this to get folder size:

$size = DirGetSize("C:\TestFolder")

Msgbox(0,"","Size(MegaBytes):" & Round($size / 1024 / 1024))

How can I get name and size of each sub-folder in TestFolder? Also, can I list all subfolder name and size in a text file?

Thanks for reading

Link to comment
Share on other sites

Hi,

If you look at the link from my signature, "recursive", there are many script example links you could modify.

The one already with size is "French.au3" I think, but others could be modified

Best, Randall

Link to comment
Share on other sites

maybe like this

#Include <GUIConstants.au3
#include <File.au3>


$loc = "C:\temp\"


GUICreate("MY GUI")
$edit = GUICtrlCreateEdit("", 25, 20, 350, 350)
GUISetState()

$list = _FileListToArray($loc, "*.*", 2)

for $x = 1 to $list[0]
    GUICtrlSetData( $edit, ($list[$x]) & @CRLF, 1 )
    GUICtrlSetData( $edit, (DirGetSize($loc & $list[$x])) & @CRLF, 1)
    GUICtrlSetData( $edit, " " & @CRLF, 1)
Next
    

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    
    EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Hi,

If you look at the link from my signature, "recursive", there are many script example links you could modify.

The one already with size is "French.au3" I think, but others could be modified

Best, Randall

the one with my name on his 'recursive request' is setup to list all files and folder sizes to a textfile. currently it doesn't use dirgetsize() to get folder size (so i think it returns 0 for folders) but if you plug that one line in, it should do exactly what you want.
Link to comment
Share on other sites

Thanks all of you Gurus out there. Special thanks to Valuater. Following is the code that I wrote, which may be bit sloppy, but does the job for me.

Thanks again! :P

#Include <GUIConstants.au3

#include <File.au3>

$loc = InputBox("Folder Size Path", "Enter the folder path", "", "")

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("**********************************************************************" & @CRLF)

Send("FOLDER SIZE: "&$loc & @CRLF)

Send("MAKE SURE NOTEPAD WINDOW IS ACTIVE WHILE APPLICATION IS RUNNING!!!!!!" & @CRLF)

Send("*********************************************************************" & @CRLF)

Send(@CRLF)

Send(@CRLF)

$list = _FileListToArray($loc, "*.*", 2)

for $x = 1 to $list[0]

Send($list[$x] & @TAB)

$temp=DirGetSize($loc & $list[$x])/1024/1024

Send(Round($temp))

Send(" MB")

Send(@CRLF)

Next

Send("************************************" & @CRLF)

Send("Done"& @CRLF)

Send("************************************"& @CRLF)

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...