Sign in to follow this  
Followers 0
Deye

variables in RFLTA Q

9 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by czardas

Share this post


Link to post
Share on other sites

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 $iRecur
If 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
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:"
 

Share this post


Link to post
Share on other sites

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? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Deye

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 path

but $iRecur reaches in to deeper paths recursively

where I just need the top level files and folders

what can I use to remove these paths from the array

I have tried this code without success

 

_ArraySearch($ff, "\", 0, 0, 0, 1)
If Not @error Then
_ArrayDelete($ff, $iIndex1)
endif

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0