Click here to Skip to main content
15,887,383 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Pete O'Hanlon8-Jan-23 4:07
mvePete O'Hanlon8-Jan-23 4:07 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
trønderen8-Jan-23 4:39
trønderen8-Jan-23 4:39 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
englebart8-Jan-23 5:04
professionalenglebart8-Jan-23 5:04 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida8-Jan-23 13:24
jmaida8-Jan-23 13:24 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
raddevus8-Jan-23 6:21
mvaraddevus8-Jan-23 6:21 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
BillWoodruff8-Jan-23 20:12
professionalBillWoodruff8-Jan-23 20:12 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
raddevus9-Jan-23 2:42
mvaraddevus9-Jan-23 2:42 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Richard Deeming8-Jan-23 22:27
mveRichard Deeming8-Jan-23 22:27 
Be careful - if your account doesn't have permission to read any of the folders in the search path, the script will fail at the first one. In .NET Framework, there's no way to make a SearchOption.AllDirectories search skip folders you don't have access to.

If you're using .NET Core 2.1 or later (including .NET 5/6/7/...), you can use the EnumerationOptions[^] class with the IgnoreInacessible property set to true to resolve this:
C#
EnumerationOptions options = new()
{
    RecurseSubdirectories = true,
    IgnoreInaccessible = true,
};

var files =  DirInfo.EnumerateFiles(filePattern, options);




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
raddevus9-Jan-23 2:44
mvaraddevus9-Jan-23 2:44 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Jörgen Andersson8-Jan-23 21:06
professionalJörgen Andersson8-Jan-23 21:06 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Jörgen Andersson8-Jan-23 21:13
professionalJörgen Andersson8-Jan-23 21:13 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
GuyThiebaut8-Jan-23 21:31
professionalGuyThiebaut8-Jan-23 21:31 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
rjmoses9-Jan-23 3:15
professionalrjmoses9-Jan-23 3:15 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jmaida9-Jan-23 8:41
jmaida9-Jan-23 8:41 
AnswerRe: Use POSIX find and grep. Pin
Jeremy Falcon9-Jan-23 9:31
professionalJeremy Falcon9-Jan-23 9:31 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
Stuart Dootson10-Jan-23 5:40
professionalStuart Dootson10-Jan-23 5:40 
GeneralRe: Recursively Searching for "text" in files in windows 11 Pin
jschell10-Jan-23 7:40
jschell10-Jan-23 7:40 
GeneralSorry (Sari) joke of the day Pin
jmaida7-Jan-23 15:16
jmaida7-Jan-23 15:16 
PraiseI've overcome the datasheet, and the hardware from heck. finally Pin
honey the codewitch7-Jan-23 14:43
mvahoney the codewitch7-Jan-23 14:43 
GeneralRe: I've overcome the datasheet, and the hardware from heck. finally Pin
jmaida7-Jan-23 14:57
jmaida7-Jan-23 14:57 
JokeRe: I've overcome the datasheet, and the hardware from heck. finally Pin
englebart8-Jan-23 5:08
professionalenglebart8-Jan-23 5:08 
GeneralRe: I've overcome the datasheet, and the hardware from heck. finally Pin
honey the codewitch8-Jan-23 5:36
mvahoney the codewitch8-Jan-23 5:36 
GeneralWordle 568 Pin
StarNamer@work7-Jan-23 13:22
professionalStarNamer@work7-Jan-23 13:22 
GeneralRe: Wordle 568 Pin
Peter_in_27807-Jan-23 13:26
professionalPeter_in_27807-Jan-23 13:26 
GeneralRe: Wordle 568 Pin
Amarnath S7-Jan-23 19:22
professionalAmarnath S7-Jan-23 19:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.