TryWare90Days Posted May 4, 2017 Posted May 4, 2017 (edited) 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. Edited May 5, 2017 by TryWare90Days [RESOLVED]
Moderators JLogan3o13 Posted May 4, 2017 Moderators Posted May 4, 2017 Moved to the correct forum, as the DEV forum very clearly states: Quote Do not create AutoIt-related topics here, use the AutoIt General Help and Support TryWare90Days 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
mikell Posted May 4, 2017 Posted May 4, 2017 This works well on my XP #include <Array.au3> #include <File.au3> Global $aArray = _FileListToArrayRec("C:\", _ "*||$Recycle.Bin;Program Files;Documents and Settings;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") TryWare90Days 1
TryWare90Days Posted May 4, 2017 Author Posted May 4, 2017 3 hours ago, mikell said: This works well on my XP #include <Array.au3> #include <File.au3> Global $aArray = _FileListToArrayRec("C:\", _ "*||$Recycle.Bin;Program Files;Documents and Settings;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") It also works on my Windows 7, but I still see the 4 "excluded" subfolders in my $aAarray. Do you see the 4 "excluded" subfolders in your XP
TryWare90Days Posted May 4, 2017 Author Posted May 4, 2017 4 hours ago, JLogan3o13 said: Moved to the correct forum, as the DEV forum very clearly states: Sorry about that, and thank you for moving it to the right forum.
Subz Posted May 4, 2017 Posted May 4, 2017 Tested on Windows 10 x64 works fine, did you change the folders for Windows 7 x64? #include <Array.au3> #include <File.au3> Global $aArray = _FileListToArrayRec("C:\", "*||$Recycle.Bin;Program Files;Program Files (x86);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") TryWare90Days 1
TryWare90Days Posted May 5, 2017 Author Posted May 5, 2017 14 hours ago, Subz said: Tested on Windows 10 x64 works fine, did you change the folders for Windows 7 x64? #include <Array.au3> #include <File.au3> Global $aArray = _FileListToArrayRec("C:\", "*||$Recycle.Bin;Program Files;Program Files (x86);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") Thank you Subz, and actually also Mikell (but I didn't study Mikell's answer good enough), you both solved the issue. I tried with no luck to use: 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) But after changing it, it works perfect as I needed because I changed the rest of the || to ; and removed the Chr(34) between the programs folders: Global $aArray = _FileListToArrayRec("C:\", "*||$Recycle.Bin;Program Files;Program Files (x86);Users;Windows", $FLTAR_FILES+$FLTAR_NOSYSTEM+$FLTAR_NOHIDDEN, $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_FULLPATH) And actually, it runs in a very few seconds before the _ArrayDisplay() is shown. BTW: Subz, on my Windows X64, the program folder is C:\Program Files, and all x86 installations are created in the C:\Program Files (x86).
TryWare90Days Posted May 5, 2017 Author Posted May 5, 2017 20 hours ago, JLogan3o13 said: Moved to the correct forum, as the DEV forum very clearly states: Hi JLogan3013 How do I close this Topic as resolved? I have already quoted how it was resolved by Subz and Mikell
Moderators JLogan3o13 Posted May 5, 2017 Moderators Posted May 5, 2017 Just edit the first post in the thread and add [RESOLVED] in front of your title. TryWare90Days 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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