pullmyefinger Posted October 12, 2017 Share Posted October 12, 2017 I am looking for a set of commands that i can use to 1. Process all files in a particular directory 2. Count the number of characters in the Name part of the filename 3. Run a loop for that many characters. 4. For 1 to X characters in the name, check for an ASCII "(" and ")" (meaning a copy of another file) 5. If I find both characters and it happens to be file(2).xxx or whatever, Delete that file. 6. Outer loop for the number of files in the folder. 7. Inner loop to check for the aforementioned characters. I can do the inner and outer loops but I need some help with the file processing commands. Any help would be appreciated as to where to look to find these commands. Link to comment Share on other sites More sharing options...
pullmyefinger Posted October 12, 2017 Author Share Posted October 12, 2017 I am looking for a set of commands that i can use to 1. Process all files in a particular directory 2. Count the number of characters in the Name part of the filename 3. Run a loop for that many characters. 4. For 1 to X characters in the name, check for an ASCII "(" and ")" (meaning a copy of another file) 5. If I find both characters and it happens to be file(2).xxx or whatever, Delete that file. 6. Outer loop for the number of files in the folder. 7. Inner loop to check for the aforementioned characters. I can do the inner and outer loops but I need some help with the file processing commands. Any help would be appreciated as to where to look to find these commands. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 12, 2017 Moderators Share Posted October 12, 2017 pullmyefinger, Please pay attention to where you post - the "Examples" section where you started this thread is clearly marked: "Do not post general support questions here". I have moved it for you, but would ask you to be more careful in future. 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...
spudw2k Posted October 12, 2017 Share Posted October 12, 2017 (edited) 9 hours ago, pullmyefinger said: where to look to find these commands Your help file is the best resource for fundamental commands and functions you can use. Many UDFs (user defined functions) are also included in the help file and packaged with AutoIt to piece these fundamental commands/functions into something useful. _FileListToArray is a good one for producing a file listing. Filenames are just strings, so string manipulation functions would be useful for counting characters; StringLen comes to mind. To parse strings, arguably RegEx is the best way to go, but also arguably the most complex. Luckily you can use basic comparators and search functions--like StringInstr-to find patterns without using RegEx...but RegEx is still worth a look. The last piece of advice I have for now if look at the File* functions and see if you can find the right one to use to Delete files. Have a look around your help file and inspect / try out the examples to get a better understanding. If you get stuck, let us know. BTW, the _FileListToArray function supports a filter, which means if you have a pattern of characters to search for which will work with the filter format of the function...seems particularly useful for what you want to accomplish as I understand. edit: 2000th post. woot Edited October 12, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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