Sign in to follow this  
Followers 0
mega128

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

8 posts in this topic

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



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

all sizes of files folders

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

:P

Share this post


Link to post
Share on other sites

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

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.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

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  
Followers 0