Jump to content

RecFileListToArray - Deprecated


Melba23
 Share

Recommended Posts

Make sure you're not using the sort feature unless needed, that can really slow it down when dealing with large amounts of files/folders.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

my bad. : i've been so inundated at work, i completely forgot I had a similar issue last year. The version of the UDF I had did not have that line. I added it to the latest version, and I'll get back to testing.

z0iid,

I am not really prepared to work on the UDF to meet what seems to me to be a pretty specific requirement - sorry. But it was you who had a memory problem a while ago when running the UDF on shares - are you sure that you are not running into the same problem? I never did add that "no . and .." line into the release version - perhaps it might work again? :huh:

As to the time it takes - that is just the CPU share it a single AutoIt thread gets. Perhaps you could try using ProcessSetPriority to increase the CPU time the thread gets while this UDF is running. ;)

M23

Link to comment
Share on other sites

forcing it to skip . and .. solved the problem. Down to less than 20 minutes for a full scan of the file share. I should know better by know that M23 code is top shelf and that problems i experience are user related.

thanks again. :)

Link to comment
Share on other sites

  • Moderators

z0iid,

Glad you got it sorted - and that my memory still works having passed 60! :D

I should know better by know that M23 code is top shelf

Gosh - thanks! :> :> :>

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • 3 weeks later...

Melba i need a little help :D

I'll check a folder for txt ( only the relative path )

I want to check if on another folder there is the same file ( or multiple files, don't know ), if yes delete it from array, if it's not exist don't do nothing

Like:

DIR1 --> File1.txt File2.txt File3.txt
DIR2 --> File2.txt File3.txt
Result --> File1.txt

or

DIR1 --> File1.txt File2.txt File3.txt
DIR2 --> File4.txt
Result --> File1.txt File2.txt File3.txt

What is wrong with this?

$Path = "C:\Test"
$Path_diff = "C:\Test\Folder"
$MelbaArray = _RecFileListToArray($Path, "*.txt", 1)

_ArrayDisplay($MelbaArray)

For $i = 1 To UBound($MelbaArray) -1
If FileExists($Path_diff & "\" & $MelbaArray[$i]) Then
_ArrayDelete($MelbaArray, $i) ; <=== This is the problem, if i use ConsoleWrite i have the correct value
EndIf
Next

_ArrayDisplay($MelbaArray)

If some file are excluded, i'd like also a msgbox with the excluded filelist

P.S When i have the honor to see a link to the helper on the first post? :D

Thanks

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud,

Firstly, you do not need my UDF for this - as there is no requirement to look into subfolders, you can use _FileListToArray. ;)

Secondly, if you are deleting things from an array you need to start from the end and work up - otherwise you run into index problems as the loop will run for the original size while the array will become a smaller size after any deletion. ;)

This works for me:

#include <File.au3>
#include <Array.au3>

$sPath = "N:\Test\Folder_1"
$sPath_diff = "N:\Test\Folder_2"

$aMainArray = _FileListToArray($sPath, "*.txt", 1)

_ArrayDisplay($aMainArray)

For $i = UBound($aMainArray) - 1 To 1 Step -1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    If FileExists($sPath_diff & "\" & $aMainArray[$i]) Then
        MsgBox(0, "Deletion", $aMainArray[$i] & " removed from array")
        _ArrayDelete($aMainArray, $i)
        $aMainArray[0] -= 1
    EndIf
Next

_ArrayDisplay($aMainArray)

All clear? :)

M23

P.S. I will look at the helper GUI again later today - thanks for the reminder. ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

In my script i have subfolder, but i have removed from example so i need your udf ;)

Only one thing, is possible to have only one msgbox with all the list? Like:

File excluded are:

1.txt

2.txt

3.txt

Thanks

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud,

Easy! :D

You have a think about how you might do it based on that code above - and if you have not come up with a solution after I have eaten lunch I will tell you then, as long as you have some code to show me! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

johnmcloud,

One small change that I would like to see in that GUI before you finish, please. As it stands there could be some confusion as to whether the checkboxes include or exclude the hidden/system/link items - at the moment you need to check the boxes to omit the items, which seeems a little illogical to me. :wacko:

I would suggest an additional line above the checkboxes: "Omit special items" - then it is obvious what checking the boxes will do. :)

M23

Edit: And as you have worked so hard on that GUI - here is how to get a single MsgBox in that earlier script. ;)

#include <File.au3>
#include <Array.au3>

$sPath = "N:\Test\Folder_1"
$sPath_diff = "N:\Test\Folder_2"

$aMainArray = _FileListToArray($sPath, "*.txt", 1)

_ArrayDisplay($aMainArray)

$sDeleted = "" ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For $i = UBound($aMainArray) - 1 To 1 Step -1
    If FileExists($sPath_diff & "\" & $aMainArray[$i]) Then
        $sDeleted &= $aMainArray[$i] & @CRLF ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        _ArrayDelete($aMainArray, $i)
        $aMainArray[0] -= 1
    EndIf
Next

_ArrayDisplay($aMainArray)

MsgBox(0, "Deleted", $sDeleted) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Melba i have update the code with your suggestion, now the checkbox work as the opposite as before ( check = exclude ) and i have add the Omit special items ( if is checked = omit all, i have make it unclickable because is based on status of other checkbox ), hope i have make everything well :D

Now i'll check it out your code "exclude from array"

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud,

I am afraid I find that even more confusing than before. :(

What I meant was something like this:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateLabel("--------------------------------------------------------------------------------------------", 10, 100, 200, 20)

GUICtrlCreateLabel("Omit special items", 10, 120, 200, 20)
GUICtrlCreateCheckbox(" Hidden files/folders", 10, 140, 120, 20)
GUICtrlCreateCheckbox(" System files/folders", 150, 140, 120, 20)
GUICtrlCreateCheckbox(" Junction/Link folders", 10, 160, 120, 20)

GUICtrlCreateLabel("--------------------------------------------------------------------------------------------", 10, 180, 200, 20)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Now it seems clear to me that checking the checkboxes will omit the relevant items and you need to add a value to the parameter. Dos that make it clearer to you as well? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

johnmcloud,

Now the logic is completely backwards! :wacko:

Title says: Omit special items

With all checked => _RecFileListToArray("M:ProgramAu3 Scripts", "*") - everything included

With none checked = _RecFileListToArray("M:ProgramAu3 Scripts", "*", 0 + 4 + 8 + 16) - everything excluded

But if you change "Omit special items" to "Include special items" and have them all checked by default I think you are there! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

johnmcloud,

That still gives the same result. As I suggested above, leave the logic alone and change the title of the group as I suggested above to "Include" - and have all 3 checked by default so that becomes the default setting. :)

And when we are all happy I will break out all the GUI posts into another thread. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Someone kill me or give me an english teacher lol.

Sorry but:

Hidden/Link/System ALL UNCHECKED --> _RecFileListToArray("C:", "*", 0 + 4 + 8 + 16)

Hidden/Link/System ALL CHECKED --> _RecFileListToArray("C:", "*")

This is the correct way, or not? If it's not i'll surrender and do what you suggest

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud.

If the title says "Omit" then checking the boxes should add the additional parameters to exclude the items - as you show above the opposite happens. :(

So just change the title to "Include" and have them all checked by default as I keep suggesting (this is the third time), Then when the checkboxes are unchecked, the additional parameters will be added and the items will be omitted. Are we finally on the same page? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

I hope this this time is the right time, i have change the title to Include as you suggested three times, the checkbox are checked by default at startup

So, title is "include"

Checkbox checked --> _RecFileListToArray("C:", "*")

Checkbox unchecked --> _RecFileListToArray("C:", "*", 0 + 4 + 8 + 16)

Link to comment
Share on other sites

  • Moderators

johnmcloud,

:thumbsup:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...