# GenXdev.FileSystem\\Find-Item

**URL:** <https://forums.powershell.org/t/genxdev-filesystem-find-item/26160>\
**Category:** Uncategorized\
**Created:** [September 18, 2025, 8:48pm UTC](https://forums.powershell.org/t/genxdev-filesystem-find-item/26160 "2025-09-18T20:48:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![genXdev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/genxdev/32/6185_2.png) [@genXdev](https://forums.powershell.org/u/genXdev)\
**Post date:** [September 18, 2025, 8:48pm UTC](https://forums.powershell.org/t/genxdev-filesystem-find-item/26160/1 "2025-09-18T20:48:04Z")

</div>

# New PowerShell Cmdlet: Find-Item (C#) for Fast File & Directory Search

Hi! I put together a C#-powered cmdlet called `Find-Item` (aliased as `l`) as part of the [GenXdev.FileSystem module on GitHub](https://github.com/genXdev/GenXdev.FileSystem). It’s designed for quick, multi-threaded searches—what do you guys think?

# Features

- ✅ Fast multi-threaded search: utilizes parallel and asynchronous IO processing with configurable maximum degree of parallelism (default based on CPU cores) for efficient file and directory scanning.
- ✅ Advanced Pattern Matching: Supports wildcards (\*, ?), recursive patterns like \*\*, and complex path structures for precise file and directory queries.
- ✅ Content Searching: Matches regular expression patterns within file contents using the -Pattern parameter, with options for case sensitivity.
- ✅ Path Type Flexibility: Handles relative, absolute, UNC, rooted paths, and NTFS alternate data streams (ADS) with optional content search in streams.
- ✅ Multi-Drive Support: Searches across all drives with -AllDrives or specific drives via -SearchDrives, including optical disks if specified.
- ✅ Directory and File Filtering: Options to search directories only (-Directory), both files and directories (-FilesAndDirectories), or files with content matching.
- ✅ Exclusion and Limits: Exclude patterns with -Exclude, set max recursion depth (-MaxRecursionDepth), file size limits (-MaxFileSize, -MinFileSize), and modified date filters (-ModifiedAfter, -ModifiedBefore).
- ✅ Output Customization: Supports PassThru for FileInfo/DirectoryInfo objects, relative paths, hyperlinks in attended mode, or plain paths in unattended mode (use -NoLinks in case of mishaps to enforce unattended mode).
- ✅ Performance Optimizations: Skips non-text files by default for content search (override with -IncludeNonTextFileMatching), handles long paths (\>260 chars), and follows symlinks/junctions.
- ✅ Safety Features: Timeout support (-TimeoutSeconds), ignores inaccessible items, skips system attributes by default, and prevents infinite loops with visited node tracking.

# Try it out!

```auto
Install-Module GenXdev.FileSystem
Import-Module GenXdev.FileSystem

```

# Here are a few example invocations (long form and short alias versions):

# Find all markdown files under profile dir:

# Long:

```auto
Find-Item "~\*.md"

```

# Short:

```auto
l "~\*.md"

```

# Find files containing a specific word:

# Long:

```auto
Find-Item -Pattern "translation"

```

# Short:

```auto
l -mc translation

```

# Find JavaScript files with a version string:

# Long:

```auto
Find-Item "*.js" "Version == `"\d\d?\.\d\d?\.\d\d?`""

```

# Short:

```auto
l *.js "Version == `"\d\d?\.\d\d?\.\d\d?`""

```

# List all directories:

# Long:

```auto
Find-Item -Directory

```

# Short:

```auto
l -dir

```

# Find XML files and pass objects:

# Long:

```auto
Find-Item ".\*.xml" -PassThru | % FullName

```

# Short:

```auto
l *.xml -pt | % FullName

```

# Include alternate data streams:

# Long:

```auto
Find-Item -IncludeAlternateFileStreams

```

# Short:

```auto
l -ads

```

# Search across all drives:

# Long:

```auto
Find-Item "*.pdf" -AllDrives

```

# Short:

```auto
l *.pdf -alldrives

```

# Custom timeout and parallelism:

# Long:

```auto
Find-Item "*.log" -TimeoutSeconds 300 -MaxDegreeOfParallelism 4

```

# Short:

```auto
l *.log -maxseconds 300 -threads 4

```

# Pipeline input:

# Long:

```auto
Get-ChildItem -Path "C:\Logs" | Find-Item -Pattern "error"

```

# Short:

```auto
ls C:\Logs | l -matchcontent "error"

```

# Limit recursion depth:

# Long:

```auto
Find-Item "*.txt" -MaxRecursionDepth 2

```

# Short:

```auto
l *.txt -maxdepth 2

```

# Filter by file size:

# Long:

```auto
Find-Item -MinFileSize 1048576 -MaxFileSize 10485760

```

# Short:

```auto
l -minsize 1048576 -maxsize 10485760

```

# Filter by modification date:

# Long:

```auto
Find-Item -ModifiedAfter "2025-01-01"

```

# Short:

```auto
l -after "2025-01-01"

```

# Filter by modification date:

# Long:

```auto
Find-Item -ModifiedBefore "2025-01-01"

```

# Short:

```auto
l -before "2025-01-01"

```

# Exclude specific patterns:

# Long:

```auto
Find-Item -Exclude "*.tmp","*\bin\*"

```

# Short:

```auto
l -skiplike "*.tmp","*\bin\*"

```

# Search specific drives:

# Long:

```auto
Find-Item "*.docx" -SearchDrives "C:\","D:\"

```

# Short:

```auto
l *.docx -drives C:\, D:\

```

# Case-sensitive content search:

# Long:

```auto
Find-Item -Pattern "Error" -CaseSensitivePattern

```

# Short:

```auto
l -matchcontent "Error" -patternmatchcase

```

# Search alternate data stream content:

# Long:

```auto
Find-Item -IncludeAlternateFileStreams -SearchADSContent -Pattern "secret"

```

# Short:

```auto
l -ads -sads -mc "secret"

```

# Complex UNC path search with timeout:

# Long:

```auto
Find-Item -SearchMask "\\server\share\proj*\**\data\*.dat" -TimeoutSeconds 60

```

# Short:

```auto
l "\\server\share\proj*\**\data\*.dat" -maxseconds 60

```

# Complex UNC path search with timeout:

# Long:

```auto
Find-Item -SearchMask "\\server\share\proj*\**\data\*.dat" -TimeoutSeconds 60

```

# Short:

```auto
l "\\server\share\proj*\**\data\*.dat" -maxseconds 60

```

# Why I built it

I needed a fast way to search files in my scripts, and C# helped with the performance. Curious if it fits into anyone else’s toolkit!

# Feedback wanted!

I’d love to hear what you think—bugs, suggestions, or if it’s useful. Check out the GenXdev.FileSystem repo for source and docs.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [November 8, 2025, 5:46am UTC](https://forums.powershell.org/t/genxdev-filesystem-find-item/26160/3 "2025-11-08T05:46:24Z")

</div>

Closed on November 8, 2025, 5:46am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
