Just a heads-up, I replaced the code in the original post with an updated version.
Changes:
Two new flags: NoHidden (excludes hidden files from results) and HiddenOnly (self explanatory)
Slightly changed the behavior of the AllowNoExt flag. Now, setting that flag and not specifying any other file types allows you to scan ONLY for files without extensions (previously you would have to set the flag and specify at least one extension, like *.faketype ).
ListFiles - scan for files easily
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
Re: ListFiles - scan for files easily
Thanks for this
Very nicely presented
Was going to code something simple and found this nice solution
Beer's on me if you are ever around!
Very nicely presented
Was going to code something simple and found this nice solution
Beer's on me if you are ever around!
I may not help with your coding
Just ask about mental issues!
http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Just ask about mental issues!
http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Re: ListFiles - scan for files easily
@kenmo
Would it be possible to add a limitation on how deep the recursion goes?
Another question:
Would it be possible to present found files + folders ([x] Include folders is used)
in a way that files for a folder are always displayed first? Atm it is a purely alphabetical listing
E.g. this is the current result:
and it would be extremely nice if there was an option to display it like this:
Which means:
Would it be possible to add a limitation on how deep the recursion goes?
Code: Select all
E.g.:
0 = No recursion limit
1, 2, 3, ... = Only traverse <x> subfolders deep
For example a directory structure:
R:\VPN
R:\VPN\data
R:\VPN\logs
R:\VPN\logs\provider
R:\VPN\logs\provider\1
R:\VPN\logs\provider\2
Then 1 would only recurse into these folders:
R:\VPN
R:\VPN\data
R:\VPN\logs
And 2 only into these:
R:\VPN
R:\VPN\data
R:\VPN\logs
R:\VPN\logs\provider
Etc.
Would it be possible to present found files + folders ([x] Include folders is used)
in a way that files for a folder are always displayed first? Atm it is a purely alphabetical listing
E.g. this is the current result:
Code: Select all
R:\VPN\
R:\VPN\config.ini
R:\VPN\data\
R:\VPN\OpenVPN.exe
...
Code: Select all
R:\VPN\
R:\VPN\config.ini
R:\VPN\OpenVPN.exe
R:\VPN\data\
...
Code: Select all
<folder>
<folder>\<files for that folder>
<folder>\<first sub folder>
<folder>\<first sub folder>\<files for that first subfolder>
<folder>\<second sub folder>
<folder>\<second sub folder>\<files for that second subfolder>
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: ListFiles - scan for files easily
Quick and dirty to limit the search depth...
Code: Select all
; Scan sub-folder, add sub-count to current count
If (Recurse) And CountString(Relative,"\")<#maxdepth
Recurse = xListFiles(Root, Relative + Name, Results(), Extensions, Flags)
If (Recurse > 0) And depth<#maxdepth
Count + Recurse
EndIf
EndIf
Re: ListFiles - scan for files easily
Thanks a lot, Michael, that solves the recursive problem for me!
Re: ListFiles - scan for files easily
You can also try a newer IncludeFile I wrote called "ScanFolder"
https://raw.githubusercontent.com/kenmo ... Folder.pbi
https://raw.githubusercontent.com/kenmo ... Folder.pbi
Code: Select all
Procedure.i ScanFolder(Folder.s, Flags.i = #Null, Extensions.s = "", RecurseDepth.i = 0, RegexPattern.s = "")
Re: ListFiles - scan for files easily
Thank you kenmo!