Search the Community
Showing results for tags '_filelisttoarrayrec'.
Found 4 results
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
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 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.
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.