Jump to content
youtuber

Just delete the txt file?

Recommended Posts

Codes are deleting all files, but I just want to delete txt files.

$file = FileSelectFolder("Select Folder", @ScriptDir)
If $file = "" Or @error Then Exit
    $FileSearch = FileFindFirstFile($file & "*.txt")
    If $FileSearch <> 1 Then
        While 1
            $FileFind = FileFindNextFile($FileSearch)
            If @extended <> 0 Then ContinueLoop
            FileDelete($file & "\" & $FileFind)
            Sleep(500)
            FileClose($FileSearch)
        WEnd
    EndIf

 

Share this post


Link to post
Share on other sites
Posted (edited)
$file = FileSelectFolder("Select Folder", @ScriptDir)
If $file = "" Or @error Then Exit
$FileSearch = FileFindFirstFile($file & "\*.txt")
If $FileSearch <> -1 Then
    While 1
        $FileFind = FileFindNextFile($FileSearch)
        If @error Then ExitLoop
        FileDelete($file & "\" & $FileFind)
        Sleep(500)
        FileClose($FileSearch)
    WEnd
EndIf

 

Edited by Marc

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

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

×
×
  • Create New...