Jump to content
Sign in to follow this  
jguinch

Strange behaviour with _FileListToArrayRec

Recommended Posts

In a folder with some files that have no extension (for example the hosts file in C:\Windows\System32\driversetc), FileListToArrayRec does not return the same thing than _FileListToArray if I use *.* as filter :

   _FileListToArray("C:\Windows\System32\driversetc", "*") : returns all files

   _FileListToArray("C:\Windows\System32\driversetc", "*.*") : returns all files

   _FileListToArrayRec("C:\Windows\System32\driversetc", "*") : returns all files

   _FileListToArrayRec("C:\Windows\System32\driversetc", "*.*") : returns only files with extensions

It seems logic that FileListToArrayRec and FileListToArray should have the same behaviour with the same filter, no ?

It's not important at all for me, but maybe developers will want to ensure that these two functions react in the same way...

Edit : sorry if this post is not in the good section. Please move it if needed.

Edited by jguinch

Share this post


Link to post
Share on other sites

You know, we have a bug tracker for these types of issues?


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

Share this post


Link to post
Share on other sites

jguinch,

This has been discussed before and is the result of _FileListToArray passing the filter directly to Windows to search for the files while _FileListToArrayRec looks through all files and uses a RegEx to extract those that match the filter. Hence the discrepancy when the filter for the latter function holds a "." - the Regex will only match a name which includes a "." while Windows is far less fussy. :)

As explained in the linked thread, we see this as a Windows "feature/bug" rather then an AutoIt problem - and we certainly have no intention of changing the behaviour of either function. I added some remarks to the Help file explaining the difference between the 2 functions - did you read them? ;)

I will be closing the bug report - please use this thread if you wish to discuss it further. :)

M23

Edit: 22k

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

 

Share this post


Link to post
Share on other sites

Thanks Melba for these informations. I did not find this topic you linked before now, sorry.

I dead read the help page, but didn't understand about the difference o:)

So no problem for me, good answer. :thumbsup:

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  

  • Similar Content

    • By Blitzkid
      Hello, i want to search several directories for files with the largest numbers behind them (Like "video123") . They dont have a datatype. But there are also files with longer names and datatypes in these folders (Like "video778.mp4"). Is it possible to filter the _FileListToArray Syntax from
      to smth. like
       
      Here is my Code
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> #include <File.au3> $filedir = @ScriptDir & "\" _checkfile() Func _checkfile() ConsoleWrite("______________________" & @CRLF) Local $arr[3] = ["music", "picture", "video"] For $i = 0 To UBound($arr) - 1 Local $arrayfiles = _FileListToArray($filedir & $arr[$i], $arr[$i] & "*", 1) If @error = 1 Then ConsoleWrite($arr[$i] & "Error 1") EndIf If @error = 4 Then ConsoleWrite($arr[$i] & "Error 2") ;Exit EndIf $arrayfilter = _ArrayMax($arrayfiles, 0, 1) Global $stringfiles = StringReplace($arrayfilter, $arr[$i], "") ConsoleWrite($arrayfilter & @CRLF) Next EndFunc ;==>_checkfile  
    • By jantograaf
      Hi all, 
      I'm trying to make a listing of all files in subdirectories on a specific level in a folder structure. Let me explain, visually, this will help things a lot.

      I have a folder structure like this:
       
      ROOT |--- SUBDIR 1 | |---- SUBDIR 1.1 | |----- SUBDIR 1.1.1 | |---- File1.ext | |----- SUBDIR 1.1.2 | |---- File2.ext | |----- SUBDIR 1.1.3 | |---- File2.ext | |----- SUBDIR 1.1.4 | |---- File2.ext | |----- SUBDIR 1.1.5 | |---- File2.ext | |---- SUBDIR 1.2 | |----- SUBDIR 1.2.1 | ..... | |---- SUBDIR 1.3 .... I use _FileListToArrayRec twice:
      - once to make an array of the specific directories I should be working at: I need all files on the x.x level, so it will go just until that depth using a negative integer for $iRecur
      - once again to create an array of all files found under that directory and its subdirectories (level x.x.x\files...)
      What happens now is that _FileListToArrayRec will always include all levels before the maximum depth is reached. The result would look like this
      Row 0 15 Row 1 Root\Subdir 1 Row 2 Root\Subdir 2 Row 3 Root\Subdir 3 Row 4 Root\Subdir 1\Subdir 1.1 Row 5 Root\Subdir 1\Subdir 1.2 Row 6 Root\Subdir 1\Subdir 1.3 ... Needless to say that when my second function iterates over this array, it will find all files twice. Once on the x level, once again on the x.x level. There is no way for me not to use the recursive option in the second iteration, since the files are actually in a subdirectory there.

      Where are the wizards of programming logic here? Since I can't seem to find a comprehensible or easily implementable solution for this issue.

      Thanks in advance and kind regards,

      Jan
    • By TryWare90Days
      Can anybody please help about how to exclude subfolders with the _FileListToArrayRec function?

      According to the F1 helpfile this should create an array including subfolders, where subfolders like Include should be excluded:
          ; And now ignoring the "Include" folder #include <Array.au3>     $aArray = _FileListToArrayRec($sAutoItDir, "*||include", $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_SORT)     _ArrayDisplay($aArray, "No 'Include' folder") But it doesn't work if I change it to:
          ; And now ignoring the "Windows" folder #include <Array.au3>     $aArray = _FileListToArrayRec("C:\", "*||Windows", $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_SORT)     _ArrayDisplay($aArray, "No 'Windows' folder")
      But this is what I really want to do: Create an array only with all filenames including full path, for all root and subfolders, sorted, but without system and hidden files, and without the following root and subfolders: C:\ $Recycle.Bin, C:\ Program Files, C:\ Program Files (x86) , C:\Users, C:\Windows
      #include <Array.au3>
      Global $aArray = _FileListToArrayRec("C:\", "*||$Recycle.Bin||" & Chr(34) & "Program Files" & Chr(34) & "||" & Chr(34) & "Program Files (x86)" & Chr(34) & "||Users||Windows", $FLTAR_FILES+$FLTAR_NOSYSTEM+$FLTAR_NOHIDDEN, $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_FULLPATH)
      _ArrayDisplay($aArray, "_ArrayDisplay is only showing the first 65.525 rows of the $aArray")
      ;    Please note: $aArray[0] shows 284.868 rows created.
      Please note, that my code above can be compiled without any syntax errors, and can run without any syntax errors, but the created array doesn't exclude any of the wanted subfolders.
       
       
    • By drorshem
      Hi,
      I'm looking to create a script which will download all *.txt files from a remote FTP server.
      Once downloaded, delete all *.txt files.
       
      Can this be achieved using AutoIt ?
    • By 232showtime
      is there a limitation for _FileListToArrayRec? I tried to a do _FileListToArrayRec in C: Directory and it takes forever for _ArrayDisplay
×
×
  • Create New...