ā Searching for all possible files with .txt extension
How i can search for all .txt files on all drives ?
10 Replies
Or i can search on one drive and then do it for another one but how
Although this is very likely to cause access violation exceptions and take a very long time
i have this
You are almost certainly going to hit an access denied exception on at least some path somewhere on the drive so I don't think that code is going to work.
it wont i need help idk i can try catch but idk
Here is a sketch of how I might approach it:
Probably want a try-catch around the EnumerateFiles call as well, exercise left to the reader.
Any reason to go breadth-first rather than depth-first? That feels like it'll end up adding lots of dirs to the queue, while the max folder depth doesn't tend to be that large
Not really, just what I did off the top of my head
There š
Alternate version
I guess you would want to call Reverse() on Directory.EnumerateDirectories() if you want the same order you would get if you did something like Get-ChildItem -Recurse (i.e., dir /s)
thank you lot of
ā¤ļø
but i cant access Desktop and Documents,i can access if im going first in directory and list files then get files name but with that code i cant
im running .exe as admin
like this i can create list return it but is there way to dont do like that and access it with ur code
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.