CyberFunk Productions Posted April 19, 2004 Share Posted April 19, 2004 How do you use _DirRemoveContents( $sPath ), where do you put it in your code, can someone give me an example please. Link to comment Share on other sites More sharing options...
CyberSlug Posted April 19, 2004 Share Posted April 19, 2004 This probably should be documented better. If you installed AutoIt with the installer, then#include <File.au3> ; This statement usually goes at the very beginning (or very end) or your programIf you compile this script into an EXE, you do not need to distribute File.au3 with itYou can also always copy the function from "C:\Program Files\AutoIt3\Include" or where ever it isexpandcollapse popup; Code goes here ; ... _DirRemoveContents( $someFolder ) ;... Exit ;============================================== ; Function from AutoIt 3.0.100 standard library ; Author(s): Jonathan Bennett <jon@hiddensoft com> Func _DirRemoveContents( $sPath ) Local $sPattern Local $sFile Local $hFile If StringRight( $sPath, 1 ) <> "\" Then $sPath = $sPath & "\" $sPattern = $sPath & "*.*" If Not FileExists( $sPath ) Then Return 0 FileDelete( $sPattern ) $hFile = FileFindFirstFile( $sPattern ) If @error Then Return 0 While 1 $sFile = FileFindNextFile( $hFile ) If @error Then ExitLoop If $sFile <> "." And $sFile <> ".." Then If StringInStr( FileGetAttrib( $sPath & $sFile ), "D" ) Then DirRemove( $sPath & $sFile, 1 ) EndIf EndIf WEnd FileClose( $hFile ) Return 1 EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now