Jump to content
Sign in to follow this  
Tiger

Remove

Recommended Posts

Remove Files and Dirs from A

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.7.1
 Author:         Tiger

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Example
Remove("C:\Test")

Func Remove($s_target, $flag = 0)
    
    If Not StringInStr(StringRight($s_target, 1), "\") Then $s_target = $s_target & "\"
    
    $ffff = FileFindFirstFile($s_target & "*")
    
    While 1
        $ffnf = FileFindNextFile($ffff)
        If @error Then ExitLoop
        
        ; Dir
        If StringInStr(FileGetAttrib($s_target & $ffnf), "D") Then
            DirRemove($s_target & $ffnf, $flag)
        ; File
        Else
            FileDelete($s_target & $ffnf)
        EndIf
    WEnd
    
    ; Close Search
    FileClose($ffff)
    
EndFunc   ;==>Remove

Remove.au3

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