youtuber Posted May 18, 2019 Share Posted May 18, 2019 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 Link to comment Share on other sites More sharing options...
Marc Posted May 18, 2019 Share Posted May 18, 2019 (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 May 18, 2019 by Marc youtuber 1 Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
mikell Posted May 18, 2019 Share Posted May 18, 2019 $folder = FileSelectFolder("Select Folder", @ScriptDir) If $folder = "" Or @error Then Exit FileDelete($folder & "\*.txt") FrancescoDiMuro, Earthshine and youtuber 3 Link to comment Share on other sites More sharing options...
Marc Posted May 18, 2019 Share Posted May 18, 2019 Short and to the point 👍 Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) 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