Jump to content
Sign in to follow this  
Kylin

How Do I Get All Folders On A DiskPart?

Recommended Posts

Kylin

I Used "dir',But I Dont Like This,Because I need a tempfile.

RunWait(@Comspec & ' /c ' & 'dir D: /b > C:\temp.txt','',@SW_HIDE)

$File = FileOpen('C:\temp.txt',0)

$i = 1

While 1
    $Var = FileReadLine($File,$i)
    If @error Then 
        ExitLoop
    EndIf

    $isFolder = DirGetSize('D:\' & $Var)
    
    If $isFolder = -1 Then
        MsgBox(1,'','File:' & $Var)
    Else
        MsgBox(1,'','Folder:' & $Var)
    EndIf
    
    $i = $i + 1
WEnd

FileClose($file)
Edited by Kylin

Share this post


Link to post
Share on other sites
Valik

Moved to correct forum.

Share this post


Link to post
Share on other sites
Kylin

Thanks Mod!

Edited by Kylin

Share this post


Link to post
Share on other sites
Paulchen

Well, this works on my compy

global $PathSave

global $fs

$objErr = ObjEvent("AutoIt.Error","ErrorHandler"); COM error handler

$fs = ObjCreate("Scripting.FileSystemObject")

_ReadDir("C:\temp")

exit

;==============================================================

Func _ReadDir($spfad)

;==============================================================

Local $dir

consolewrite($spfad & @CRLF)

$PathSave = $spfad ;Need for error msg

$dir = $fs.GetFolder($spfad)

For $subdir in $dir.SubFolders()

if @error Then

ConsoleWrite ("Error " & $subdir &" Folder Error : " & @error & " " & @CRLF)

else

_ReadDir($subdir.Path)

if @error Then ConsoleWrite( "Error " & $PathSave &" Folder Error1 : " & @error & @CRLF)

EndIf

Next

EndFunc

;==============================================================

Func ErrorHandler()

;==============================================================

Local $HexNumber = Hex($objErr.number, 8)

MsgBox(0,"COM ERROR Occured!", $PathSave & @CRLF & _

@TAB & "Error Number: " & $HexNumber & @CRLF & _

@TAB & "Source: " & $objErr.source & @CRLF & _

@TAB & "Error Number: " & $objErr.number & @CRLF & _

@TAB & "Script Line Number: " & $objErr.scriptline & @CRLF & _

@TAB & "Description: " & $objErr.description & @CRLF & _

@TAB & "Helpfile: " & $objErr.helpfile & @CRLF & _

@TAB & "Helpcontext: " & $objErr.helpcontext & @CRLF & _

@TAB & "Lastdllerror: " & $objErr.lastdllerror & @CRLF & _

@TAB & "WinDescription: " & $objErr.windescription & @CRLF )

ConsoleWrite("Error " & $PathSave & " Error Number " & $objErr.number & " at line " & $objErr.scriptline & @CRLF )

Return SetError($objErr.number, 0, 0)

EndFunc

Share this post


Link to post
Share on other sites
neuro

Well, this works on my compy [...]

Yeah, that works beautifully - thank you for sharing.

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  

×