Jump to content
Sign in to follow this  
mega128

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

Recommended Posts

mega128

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

Share this post


Link to post
Share on other sites
randallc

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

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
Share on other sites
MrSpacely

all sizes of files folders

_rundos("dir " & @scriptdir & "\*.* /s /o /a > output.txt")

:P

Share this post


Link to post
Share on other sites
Valuater

all sizes of files folders

_rundos("dir " & @scriptdir & "\*.* /s /o /a > output.txt")

:P

be sure to include

#include <Process.au3>

*******************************

i got an empty file?????

and yes ... there are sub-folders

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
seandisanti

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.

Share this post


Link to post
Share on other sites
Zach

all sizes of files folders

_rundos("dir " & @scriptdir & "\*.* /s /o /a > output.txt")

Thanks - nice to see that someone still is smart enough to not reinvent the wheel :P

Edited by Zach

Share this post


Link to post
Share on other sites
mega128

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)

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  

×