OmenSWE Posted December 19, 2010 Share Posted December 19, 2010 Okay this is what I'm trying to do. So i got a bunch of folders in a hard drive and in different map's i have a .txt file. So i want a program that remove all those .txt files in every map. My coding is not good.. i mostly do copy and pasting.. ye i'm a little ashamed about that.. what i have made so far. #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray("G:\test", "*", 2) _ArrayDisplay($FileList,"$FileList") # see what maps it found # Ye i know there is a big problem below. # I should have some thing like $FileList[0] in it.. FileDelete("G:\test\"$FileList&"*.txt") Thanks if you taking the time to help me. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2010 Moderators Share Posted December 19, 2010 OmenSWE, No need to feel stupid - we all started at the same point! This should do the trick: #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray("G:\test", "*", 2) _ArrayDisplay($FileList,"$FileList") ; see what maps it found ; Now loop through the found folders For $i = 1 To $FileList[0] ; And delete the *.txt file within them FileDelete("G:\test\" & $FileList[$i] & "\*.txt") Next Please ask if you have any questions on the code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OmenSWE Posted December 19, 2010 Author Share Posted December 19, 2010 OmenSWE, No need to feel stupid - we all started at the same point! This should do the trick: #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray("G:\test", "*", 2) _ArrayDisplay($FileList,"$FileList") ; see what maps it found ; Now loop through the found folders For $i = 1 To $FileList[0] ; And delete the *.txt file within them FileDelete("G:\test\" & $FileList[$i] & "\*.txt") Next Please ask if you have any questions on the code. M23 Thanks you! now to make it a little nicer.. Any way to make it say how many files its going to remove? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2010 Moderators Share Posted December 19, 2010 OmenSWE, First, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. make it say how many files its going to remove?You already have the answer - how do you find out how many folders you have to check in your loop? Run _FileListToArray again to count how many *.txt files in each folder. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OmenSWE Posted December 19, 2010 Author Share Posted December 19, 2010 Okay.. but i want it to find more then just a txt file. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2010 Moderators Share Posted December 19, 2010 OmenSWE,If you want help, then you need to properly formulate questions. What do you want to find then? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OmenSWE Posted December 19, 2010 Author Share Posted December 19, 2010 Well i want it to find .bin .iso .mkv files and remove them. Link to comment Share on other sites More sharing options...
Fubarable Posted December 19, 2010 Share Posted December 19, 2010 So why not give it a try as the logic is the same. If your code doesn't work after your attempt, then post it. 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