PSItems PowerShell Module that Finds Files and Folders
PSItems PowerShell Module that Finds Files and Folders

PSItems: A PowerShell Module that Finds Files & Folders

A PowerShell module that finds files and directories as well as file and directory information the quick and easy way!

Overview

Info

📝 The functions of the module do not run with Windows PowerShell, they require at least PowerShell > 6.0 or a newer version. The latest, stable PowerShell version is always recommended

As a person who works a lot with Linux distributions and had not found a way on Windows to find files or folders or their information in a FAST way, I developed this module or functions. At the beginning I was looking for an alternative to the Linux find and developed Find-Item.

Of course, all the functions in this module will be working on Windows, Linux and macOS.

Get-ChildItem works great to get an overview of current files and folders, but is very, very slow when dealing with a lot of filesystem objects. So I decided to use the .NET classes directly and used only the functionalities I really need for the particular case.

"
"

Since then, I don’t have to bother with the Windows Explorer built-in search or struggle around with slowly calling Get-ChildItem.

The term “item” in PSItems or also the individual function names is a collective term for all file system objects, such as files and directories. Therefore, for example, the function is called Find-Item and not Find-File, because with it also junctions, directories, shortcuts etc. can be found.

Installation

Installation of this module is straight forward, just install it and import it.

Install-Module -Name PSItems
Import-Module -Name PSItems

Usage

The usage and a few examples can be found in the documentation folder or by using the Get-Help cmdlet.

CmdletDescriptionDocumentation
Find-ItemSimple and fast function for finding any item on the filesystem (like find on linux/unix)Find-Item
Get-ItemSizeSimple and fast function for getting the size of any item on the filesystem (like du on linux/unix)Get-ItemSize

Functions

Get functions of module:

Get-Command -Module PSItems -CommandType All
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           ff -> Find-Item                                    0.2.3      PSItems
Alias           fi -> Find-Item                                    0.2.3      PSItems
Alias           gis -> Get-ItemSize                                0.2.3      PSItems
Alias           search -> Find-Item                                0.2.3      PSItems
Alias           size -> Get-ItemSize                               0.2.3      PSItems
Function        Find-Item                                          0.2.3      PSItems
Function        Get-ItemSize                                       0.2.3      PSItems

Help

Get help of function:

Get-Help Find-Item
NAME
    Find-Item

SYNOPSIS
    Simple and fast function for finding any item on the filesystem (like find on linux/unix)


SYNTAX
    Find-Item [[-Path] <String>] [[-Name] <String[]>] [-Type <String>] [-Recurse] [-IgnoreInaccessible <Boolean>] [-As <String>] [-MatchCasing <String>] [-AttributesToSkip <String[]>] [-MatchType
    <String>] [-Depth <Int32>] [-ReturnSpecialDirectories] [<CommonParameters>]
...

Testing and Speed

Note

Testsystem was a windows 10 Lenovo T480 (SSD + Indexing disabled).

Test 1 – Windows directory recursively – Return FullName string

Returned will be an array of the path of all files (FullName).

Measure-Command { $windir = search C:\Windows\ '*' -Recurse -AttributesToSkip 0 }

Finding all items (files, directories…) in C:Windows directory including all subdirectories (-Recurse) as well as hidden and system files (-AttributesToSkip 0) using the Find-Item function

The alias search was used and for the -Path (C:\windows) and -Name ('*') parameter the first and second position were used:

"
"
Test 1 by PSItems
Test 1 by PSItems

In about 1 minute the function found all files, directories etc. in the complete windows directory and returned an array of all item FullName properties.

Test 2 – Windows directory recursively – Return FileInfo Object

Returned will be an array of objects (FileInfo) of all items. Same as using Get-ChildItem.

Measure-Command { $windir = search C:\Windows\ '*' -Recurse -AttributesToSkip 0 -As FileInfo }

Finding all items (files, directories…) in C:Windows directory including all subdirectories (-Recurse) as well as hidden and system files (-AttributesToSkip 0) using the Find-Item function.

The alias search was used and for the -Path (C:\windows) and -Name ('*') parameter the first and second position were used:

Test 2 by PSItems
Test 2 by PSItems
FileInfo objects for PSItems
FileInfo objects for PSItems

In about 2 minutes the function found all files, directories etc. in the complete windows directory and returned an array of FileInfo objects of all items with all properties. As with Get-ChildItem, you can simply continue to use the individual objects.

Dark Mode

PSItems (this link opens in a new window) by eizedev (this link opens in a new window)

A PowerShell module that finds files, folders and their information in a really fast and easy way!