Valnurat Posted August 5, 2016 Posted August 5, 2016 (edited) I'm not sure how I should approach this, but I have a folder with a lot of text files. I would like to open the files 1 by 1 and read the content of them and then delete the file. How should I do this? Sorry but I have no code. Edited August 5, 2016 by Valnurat Yours sincerely Kenneth.
Moderators Melba23 Posted August 5, 2016 Moderators Posted August 5, 2016 Valnurat, _FileListToArray sounds like a good place to start - followed by a For...Next loop around FileRead & FileDelete/Recycle. 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
TheDcoder Posted August 5, 2016 Posted August 5, 2016 #include <File.au3> Global $aFiles = _FileListToArray(@ScriptDir, '*.txt', $FLTA_FILES, True) Global $sText For $i = 1 To $aFiles[0] $sText = FileRead($aFiles[$i]) MsgBox(0, "Text File", $sText) Next This little script displays the contents of all the text files in the @ScriptDir. Customize the script to fit your needs . EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Valnurat Posted August 5, 2016 Author Posted August 5, 2016 Argh, yes. Doh. I was so locked in my mind that I couldn't think straight. Thank you. Yours sincerely Kenneth.
TheDcoder Posted August 5, 2016 Posted August 5, 2016 It happens @Valnurat EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
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