Deye Posted January 18, 2015 Posted January 18, 2015 Hello, I'm new to this forum and quite new to autoit using SciTE Version 3.3.7 I have tried in different ways to make the $y var accepted by the given parse space _FileListToArrayRec ($x, "*||$y", 2 + 4 + 8 +16) couldn't yet find my way around this .. thanks in advance for any help
czardas Posted January 19, 2015 Posted January 19, 2015 (edited) I haven't used this UDF so much, so I'm not sure about your syntax. In any case, you are passing a variable name as a string. Instead try concatenating like this: "*||" & $y Edited January 19, 2015 by czardas operator64 ArrayWorkshop
Moderators Melba23 Posted January 19, 2015 Moderators Posted January 19, 2015 Deye,Welcome to the AutoIt forums. You need to concatenate the variable containing the folders to be excluded - and that parameter is only valid if you search recursively, as explained in the Help file. I would try this:_FileListToArrayRec ($x, "*||" & $y, 2 + 4 + 8 +16, 1) ; Added $iRecurIf that does not work, let me know what the $x & $y variables are supposed to contain. 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
Deye Posted January 19, 2015 Author Posted January 19, 2015 Here is an example $x =Use a real path on your PC machine $x = "C:\Users\user\Documents\1111\2222\333\..." Do $y = StringRegExpReplace($x, ".*\\", "") $x = StringLeft($x, StringInStr($x, "\", 0, -1) - 1) MsgBox(0, "folder to exclude", $y) $ff = _FileListToArrayRec($x, "*||", 2 + 4 + 8 + 16, 0) _ArrayDisplay($ff) Until $x = "C:"
Moderators Melba23 Posted January 19, 2015 Moderators Posted January 19, 2015 Deye,You are not concatenating the "folder to exclude" variable - and you are not setting $iRecur to 1, therefore no exclusion takes place as I explained above. What exactly are you trying to achieve? 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
Deye Posted January 19, 2015 Author Posted January 19, 2015 (edited) well the command i used work just fine here in getting only the folder names of each path i was trying to exlude full folder paths in finally copying just folders i want without the one i want to exlude using an exclude in "name" wont do because i have folders in different paths holding the same name... Edited January 19, 2015 by Deye
Moderators Melba23 Posted January 19, 2015 Moderators Posted January 19, 2015 Deye,As you have discovered, the "Exclude_Folders" parameter will only look for a folder name, not a full path. The only solution I can see would be to get the entire tree and then search the returned array for the path in question and delete any entries found. 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
Deye Posted January 20, 2015 Author Posted January 20, 2015 I have found it easy to delete the folder to exclude via _ArraySearch and _ArrayDelete now i'm looking to exclude a list of folders in pathbut $iRecur reaches in to deeper paths recursivelywhere I just need the top level files and folderswhat can I use to remove these paths from the arrayI have tried this code without success _ArraySearch($ff, "\", 0, 0, 0, 1) If Not @error Then _ArrayDelete($ff, $iIndex1) endif
Moderators Melba23 Posted January 20, 2015 Moderators Posted January 20, 2015 Deye,Once you have the list of top level files and folders then you will need to loop through the array from the bottom up and delete elements as you go. Something like this should work - it does on my system: #include <File.au3> #include <Array.au3> $sPath = "M:\" Global $aExclude[] = ["M:\Program", "M:\Downloads"] $aList = _FileListToArray($sPath, "*", $FLTA_FILESFOLDERS, True) ; Get full list _ArrayDisplay($aList, "Original", Default, 8) For $i = $aList[0] To 1 Step -1 ; Loop up through the array For $j = 0 To UBound($aExclude) - 1 ; Look for each possible exclude path If $aList[$i] = $aExclude[$j] Then _ArrayDelete($aList, $i) ; Delete the list element $aList[0] -= 1 ; Reduce the count value EndIf Next Next _ArrayDisplay($aList, "Adjusted", Default, 8)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
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