Skip to content

genXdev/GenXdev.FileSystem

Repository files navigation


GenXdev


NAME

GenXdev.FileSystem

SYNOPSIS

A Windows PowerShell module for basic and advanced file management tasks

GenXdev.FileSystem License

FEATURES

* âś… Simple but agile utility for renaming text throughout a project directory,
      including file- and directory- names: Rename-InProject -> rip

* âś… Pretty good wrapper for robocopy, Microsoft's robuust file copy utility: Start-RoboCopy -> rc, xc
    * âś… Folder synchronization
    * âś… Support for extra long pathnames > 256 characters
    * âś… Restartable mode backups
    * âś… Support for copying and fixing security settings
    * âś… Advanced file attribute features
    * âś… Advanced symbolic link and junction support
    * âś… Monitor mode (restart copying after change threshold)
    * âś… Optimization features for LargeFiles, multithreaded copying and network compression
    * âś… Recovery mode (copy from failing disks)
    *
* âś… Find files with Find-Item -> l
    * âś… Returns relative paths by default
    * âś… Or passes Get-ChildItem objects to the pipeline
    * âś… Search all drives with -AllDrives
    * âś… Accepts wildcards
    * âś… Match files with regex patterns for searching within file content with -Pattern

* âś… Delete complete directory contents with Remove-AllItems -> sdel
    * âś… Optionally delete the root folder as well

* âś… Move files and directories with Move-ItemWithTracking
    * âś… Preserves file system links and references for tools like Git

SYNTAX

Start-RoboCopy [-Source] <String> [[-DestinationDirectory] <String>] [[-Files] <String[]>]
    [-Mirror] [-Move]
    [-IncludeSecurity] [-SkipDirectories]
    [-CopyOnlyDirectoryTreeStructureAndEmptyFiles]
    [-FileExcludeFilter <String[]>]
    [-SkipAllSymbolicLinks] [-SkipSymbolicFileLinks] [-CopySymbolicLinksAsLinks]
    [-SkipFilesWithoutArchiveAttribute] [-ResetArchiveAttributeAfterSelection]
    [-AttributeIncludeFilter <String>] [-AttributeExcludeFilter <String>]
    [-SetAttributesAfterCopy <String>] [-RemoveAttributesAfterCopy <String>]
    [-MinFileSize <Int32>] [-MaxFileSize <Int32>]
    [-MinFileAge <Int32>] [-MaxFileAge <Int32>]
    [-MinLastAccessAge <Int32>] [-MaxLastAccessAge <Int32>] [-RecoveryMode] [-MonitorMode]
    [-MonitorModeThresholdMinutes <Int32>] [-MonitorModeThresholdNrOfChanges <Int32>]
    [-MonitorModeRunHoursFrom <Int32>] [-MonitorModeRunHoursUntil <Int32>] [-LogFilePath <String>]
    [-LogfileOverwrite] [-LogDirectoryNames] [-LogAllFileNames] [-Unicode] [-LargeFiles]
    [-MultiThreaded] [-CompressibleContent] [[-Override] <String>]
    [-Force]
    [-WhatIf] [<CommonParameters>]
Rename-InProject [[-Source] <String>]
                 [-FindText] <String>
                 [-ReplacementText] <String>
                 [-WhatIf] [<CommonParameters>]

INSTALLATION

Install-Module "GenXdev.FileSystem"
Import-Module "GenXdev.FileSystem"

UPDATE

Update-Module





Cmdlet Index

GenXdev.FileSystem

Command                  aliases          Description
EnsurePester Ensures Pester testing framework is available for use.
Expand-Path ep Expands any given file reference to a full pathname.
Find-DuplicateFiles fdf Find duplicate files across multiple directories based on configurable criteria.
Find-Item l Performs advanced file and directory searches with content filtering capabilities.
Invoke-Fasti fasti Extracts archive files in the current directory and deletes the originals.
Move-ItemWithTracking Moves files and directories while preserving filesystem links and references.
Move-ToRecycleBin recycle Moves files and directories to the Windows Recycle Bin safely.
Remove-AllItems sdel Recursively removes all content from a directory with advanced error handling.
Remove-ItemWithFallback rmf Removes files or directories with multiple fallback mechanisms for reliable deletion.
Remove-OnReboot Marks files or directories for deletion during the next system boot.
Rename-InProject rip Performs case-sensitive text replacement throughout a project directory.
Start-RoboCopy xc, rc Provides a PowerShell wrapper for Microsoft's Robust Copy (RoboCopy) utility.





Cmdlets

 


GenXdev.FileSystem

NAME EnsurePester

SYNOPSIS Ensures Pester testing framework is available for use.

SYNTAX EnsurePester []

DESCRIPTION This function verifies if the Pester module is installed in the current PowerShell environment. If not found, it automatically installs it from the PowerShell Gallery and imports it into the current session. This ensures that Pester testing capabilities are available when needed.

PARAMETERS This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > EnsurePester
This ensures Pester is installed and ready for use

RELATED LINKS





NAME Expand-Path

SYNOPSIS Expands any given file reference to a full pathname.

SYNTAX Expand-Path [-FilePath] [-CreateDirectory] [-CreateFile] [-DeleteExistingFile] [-ForceDrive ] [-FileMustExist] [-DirectoryMustExist] []

DESCRIPTION Expands any given file reference to a full pathname, with respect to the user's current directory. Can optionally assure that directories or files exist.

PARAMETERS -FilePath The file path to expand to a full path.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-CreateDirectory [<SwitchParameter>]
    Will create directory if it does not exist.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CreateFile [<SwitchParameter>]
    Will create an empty file if it does not exist.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-DeleteExistingFile [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-ForceDrive <Char>
    
    Required?                    false
    Position?                    named
    Default value                *
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-FileMustExist [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-DirectoryMustExist [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > Expand-Path -FilePath ".\myfile.txt" -CreateFile






-------------------------- EXAMPLE 2 --------------------------

PS > ep ~\documents\test.txt -CreateFile

RELATED LINKS





NAME Find-DuplicateFiles

SYNOPSIS Find duplicate files across multiple directories based on configurable criteria.

SYNTAX Find-DuplicateFiles [-Paths] <String[]> [[-DontCompareSize]] [[-DontCompareModifiedDate]] []

DESCRIPTION Recursively searches specified directories for duplicate files. Files are considered duplicates if they share the same name and optionally match on size and modification date. Returns groups of duplicate files for further processing.

PARAMETERS -Paths <String[]> Array of directory paths to recursively search for duplicate files. Accepts pipeline input and wildcard paths.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-DontCompareSize [<SwitchParameter>]
    When specified, file size is not used as a comparison criterion, only names
    are matched.
    
    Required?                    false
    Position?                    2
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-DontCompareModifiedDate [<SwitchParameter>]
    When specified, file modification dates are not used as a comparison criterion.
    
    Required?                    false
    Position?                    3
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > Find-DuplicateFiles -Paths "C:\Photos","D:\Backup\Photos"






-------------------------- EXAMPLE 2 --------------------------

PS > "C:\Photos","D:\Backup\Photos" | fdf -DontCompareSize

RELATED LINKS





NAME Find-Item

SYNOPSIS Performs advanced file and directory searches with content filtering capabilities.

SYNTAX Find-Item [[-SearchMask] <String[]>] [[-RelativeBasePath] ] [-AllDrives] [-PassThru] [-IncludeAlternateFileStreams] [-NoRecurse] []

Find-Item [[-SearchMask] <String[]>] [[-Pattern] <String>] [[-RelativeBasePath] <String>] [-AllDrives] [-PassThru] [-IncludeAlternateFileStreams] [-NoRecurse] [<CommonParameters>]

Find-Item [[-SearchMask] <String[]>] [[-RelativeBasePath] <String>] [-AllDrives] [-Directory] [-FilesAndDirectories] [-PassThru] [-IncludeAlternateFileStreams] [-NoRecurse] [<CommonParameters>]

DESCRIPTION A powerful search utility that combines file/directory pattern matching with content filtering. Supports recursive searches, multi-drive operations, and flexible output formats. Can search by name patterns and content patterns simultaneously.

PARAMETERS -SearchMask <String[]> File or directory pattern to match against. Supports wildcards (,?). Default is "" to match everything.

    Required?                    false
    Position?                    1
    Default value                *
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  true
    
-Pattern <String>
    Regular expression to search within file contents. Only applies to files.
    Default is ".*" to match any content.
    
    Required?                    false
    Position?                    2
    Default value                .*
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  true
    
-RelativeBasePath <String>
    Base directory for generating relative paths in output.
    Only used when -PassThru is not specified.
    
    Required?                    false
    Position?                    3
    Default value                .\
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-AllDrives [<SwitchParameter>]
    When specified, searches across all available filesystem drives.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Directory [<SwitchParameter>]
    Limits search to directories only, ignoring files.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-FilesAndDirectories [<SwitchParameter>]
    Includes both files and directories in search results.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-PassThru [<SwitchParameter>]
    Returns FileInfo/DirectoryInfo objects instead of paths.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-IncludeAlternateFileStreams [<SwitchParameter>]
    Include alternate data streams in search results.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-NoRecurse [<SwitchParameter>]
    Prevents recursive searching into subdirectories.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > Find all files with that have the word "translation" in their content
Find-Item -Pattern "translation"

or in short
l -mc translation




-------------------------- EXAMPLE 2 --------------------------

PS > Find any javascript file that tests a version string in it's code
Find-Item -SearchMask *.js -Pattern "Version == `"\d\d?\.\d\d?\.\d\d?`""

or in short
l *.js "Version == `"\d\d?\.\d\d?\.\d\d?`""




-------------------------- EXAMPLE 3 --------------------------

PS > Find any node_modules\react-dom folder on all drives
Find-Item -SearchMask "node_modules\react-dom" -Pattern "Version == `"\d\d?\.\d\d?\.\d\d?`""

or in short
l *.js "Version == `"\d\d?\.\d\d?\.\d\d?`""




-------------------------- EXAMPLE 4 --------------------------

PS > Find all directories in the current directory and its subdirectories
Find-Item -Directory

or in short
l -dir




-------------------------- EXAMPLE 5 --------------------------

PS > Find all files with the .log extension in all drives
Find-Item -SearchMask "*.log" -AllDrives

or in short
l *.log -all




-------------------------- EXAMPLE 6 --------------------------

PS > Find all files with the .config extension and search for the pattern "connectionString" within the files
Find-Item -SearchMask "*.config" -Pattern "connectionString"

or in short
l *.config connectionString




-------------------------- EXAMPLE 7 --------------------------

PS > Find all files with the .xml extension and pass the objects through the pipeline
Find-Item -SearchMask "*.xml" -PassThru

or in short
l *.xml -PassThru




-------------------------- EXAMPLE 8 --------------------------

PS > Find all files and also include alternate data streams
Find-Item -IncludeAlternateFileStreams

or in short
l -ads




-------------------------- EXAMPLE 9 --------------------------

PS > Find only the alternate data streams (not the base files) for all .jpg files
Find-Item -SearchMask "*.jpg:"

This syntax automatically enables -IncludeAlternateFileStreams




-------------------------- EXAMPLE 10 --------------------------

PS > Find jpg files that have a stream named "Zone.Identifier"
Find-Item -SearchMask "*.jpg:Zone.Identifier"

No need to specify -IncludeAlternateFileStreams, it's automatically enabled




-------------------------- EXAMPLE 11 --------------------------

PS > Find all alternate filestreams in the current directory and beyond
containing "secret" text in their content
Find-Item -SearchMask "*:*" -Pattern "secret"

This will find all alternate streams in any file that contain the word "secret"




-------------------------- EXAMPLE 12 --------------------------

PS > Find files with Zone.Identifier streams and return them as objects
Find-Item "*:Zone*" -PassThru

Returns System.IO.FileInfo.AlternateDataStream objects with full FileInfo compatibility

RELATED LINKS





NAME Invoke-Fasti

SYNOPSIS Extracts archive files in the current directory and deletes the originals.

SYNTAX Invoke-Fasti [[-Password] ] []

DESCRIPTION Automatically extracts common archive formats (zip, 7z, tar, etc.) found in the current directory into individual folders named after each archive. After successful extraction, the original archive files are deleted. Requires 7-Zip to be installed on the system.

PARAMETERS -Password

    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

NOTES

    Supported formats: 7z, zip, rar, tar, iso and many others.
    Requires 7-Zip installation (will attempt auto-install via winget if missing).

-------------------------- EXAMPLE 1 --------------------------

PS C:\Downloads>Invoke-Fasti






-------------------------- EXAMPLE 2 --------------------------

PS C:\Downloads>fasti

RELATED LINKS





NAME Move-ItemWithTracking

SYNOPSIS Moves files and directories while preserving filesystem links and references.

SYNTAX Move-ItemWithTracking [-Path] [-Destination] [-Force] [-WhatIf] [-Confirm] []

DESCRIPTION Uses the Windows MoveFileEx API to move files and directories with link tracking enabled. This ensures that filesystem references, symbolic links, and hardlinks are maintained. The function is particularly useful for tools like Git that need to track file renames.

PARAMETERS -Path The source path of the file or directory to move. Accepts pipeline input and aliases to FullName for compatibility with Get-ChildItem output.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-Destination <String>
    The target path where the file or directory should be moved to. Must be a valid
    filesystem path.
    
    Required?                    true
    Position?                    2
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Force [<SwitchParameter>]
    If specified, allows overwriting an existing file or directory at the
    destination path.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS System.Boolean Returns $true if the move operation succeeds, $false otherwise.

-------------------------- EXAMPLE 1 --------------------------

PS > Move-ItemWithTracking -Path "C:\temp\oldfile.txt" -Destination "D:\newfile.txt"
Moves a file while preserving any existing filesystem links






-------------------------- EXAMPLE 2 --------------------------

PS > "C:\temp\olddir" | Move-ItemWithTracking -Destination "D:\newdir" -Force
Moves a directory, overwriting destination if it exists

RELATED LINKS





NAME Move-ToRecycleBin

SYNOPSIS Moves files and directories to the Windows Recycle Bin safely.

SYNTAX Move-ToRecycleBin [-Path] <String[]> [-WhatIf] [-Confirm] []

DESCRIPTION Safely moves files or directories to the recycle bin using the Windows Shell API, even if they are currently in use. The function uses the Shell.Application COM object to perform the operation, ensuring proper recycling behavior and undo capability.

PARAMETERS -Path <String[]> One or more paths to files or directories that should be moved to the recycle bin. Accepts pipeline input and wildcards. The paths must exist and be accessible.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS System.Boolean

-------------------------- EXAMPLE 1 --------------------------

PS > Move-ToRecycleBin -Path "C:\temp\old-report.txt"
Moves a single file to the recycle bin






-------------------------- EXAMPLE 2 --------------------------

PS > "file1.txt","file2.txt" | recycle
Moves multiple files using pipeline and alias

RELATED LINKS





NAME Remove-AllItems

SYNOPSIS Recursively removes all content from a directory with advanced error handling.

SYNTAX Remove-AllItems [-Path] [[-DeleteFolder]] [-WhatIf] [-Confirm] []

DESCRIPTION Safely removes all files and subdirectories within a specified directory using a reverse-order deletion strategy to handle deep paths. Includes WhatIf support, verbose logging, and fallback deletion methods for locked files.

PARAMETERS -Path The directory path to clear. Can be relative or absolute path. Will be normalized and expanded before processing.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-DeleteFolder [<SwitchParameter>]
    When specified, also removes the root directory specified by Path after clearing
    its contents.
    
    Required?                    false
    Position?                    2
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    Shows what would happen if the cmdlet runs. The cmdlet is not run.
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > Remove-AllItems -Path "C:\Temp\BuildOutput" -DeleteFolder -Verbose






-------------------------- EXAMPLE 2 --------------------------

PS > sdel ".\temp" -DeleteFolder

RELATED LINKS





NAME Remove-ItemWithFallback

SYNOPSIS Removes files or directories with multiple fallback mechanisms for reliable deletion.

SYNTAX Remove-ItemWithFallback [-Path] [-CountRebootDeletionAsSuccess] [-WhatIf] [-Confirm] []

DESCRIPTION This function provides a robust way to delete files and directories by attempting multiple deletion methods in sequence: 1. Direct deletion via System.IO methods for best performance 2. PowerShell provider-aware Remove-Item cmdlet as fallback 3. Mark for deletion on next system reboot if other methods fail This ensures maximum reliability when removing items across different providers.

PARAMETERS -Path The file or directory path to remove. Can be a filesystem path or provider path. Accepts pipeline input and wildcards. Must be a valid, non-empty path.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue, ByPropertyName)
    Aliases                      
    Accept wildcard characters?  false
    
-CountRebootDeletionAsSuccess [<SwitchParameter>]
    If specified, the function returns $true when a file is successfully marked for deletion on reboot.
    By default ($false), the function returns $false in this scenario.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS System.Boolean

-------------------------- EXAMPLE 1 --------------------------

PS > Remove-ItemWithFallback -Path "C:\temp\myfile.txt"
Attempts to remove the file using all available methods.






-------------------------- EXAMPLE 2 --------------------------

PS > "C:\temp\mydir" | rif
Uses the alias 'rif' to remove a directory through the pipeline.

RELATED LINKS





NAME Remove-OnReboot

SYNOPSIS Marks files or directories for deletion during the next system boot.

SYNTAX Remove-OnReboot [-Path] <String[]> [-MarkInPlace] [-WhatIf] [-Confirm] []

DESCRIPTION This function uses the Windows API to mark files for deletion on next boot. It handles locked files by first attempting to rename them to temporary names and tracks all moves to maintain file system integrity. If renaming fails, the -MarkInPlace parameter can be used to mark files in their original location.

PARAMETERS -Path <String[]> One or more file or directory paths to mark for deletion. Accepts pipeline input.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       true (ByValue)
    Aliases                      
    Accept wildcard characters?  false
    
-MarkInPlace [<SwitchParameter>]
    If specified, marks files for deletion in their original location when renaming
    fails. This is useful for locked files that cannot be renamed.
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS System.Boolean

-------------------------- EXAMPLE 1 --------------------------

PS > Remove-OnReboot -Path "C:\temp\locked-file.txt"






-------------------------- EXAMPLE 2 --------------------------

PS > "file1.txt","file2.txt" | Remove-OnReboot -MarkInPlace

RELATED LINKS





NAME Rename-InProject

SYNOPSIS Performs case-sensitive text replacement throughout a project directory.

SYNTAX Rename-InProject [[-Source] ] [-FindText] [-ReplacementText] [-WhatIf] [-Confirm] []

DESCRIPTION Recursively searches through files and directories in a project to perform text replacements. Handles both file/directory names and file contents. Skips common binary files and repository folders (.git, .svn) to avoid corruption. Uses UTF-8 encoding without BOM for file operations.

PARAMETERS -Source The directory, filepath, or directory+searchmask to process. Defaults to current directory if not specified.

    Required?                    false
    Position?                    1
    Default value                .\
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-FindText <String>
    The case-sensitive text pattern to search for in filenames and content.
    
    Required?                    true
    Position?                    2
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-ReplacementText <String>
    The text to replace all instances of FindText with.
    
    Required?                    true
    Position?                    3
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    Shows what changes would occur without actually making them.
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > Rename-InProject -Source .\src\*.js -FindText "oldName" `
    -ReplacementText "newName"






-------------------------- EXAMPLE 2 --------------------------

PS > rip . "MyClass" "MyNewClass" -WhatIf

RELATED LINKS





NAME Start-RoboCopy

SYNOPSIS Provides a PowerShell wrapper for Microsoft's Robust Copy (RoboCopy) utility.

SYNTAX Start-RoboCopy [-Source] [[-DestinationDirectory] ] [[-Files] <String[]>] [-Mirror] [-Move] [-IncludeSecurity] [-SkipDirectories] [-CopyOnlyDirectoryTreeStructureAndEmptyFiles] [-SkipAllSymbolicLinks] [-SkipSymbolicFileLinks] [-CopySymbolicLinksAsLinks] [-Force] [-SkipFilesWithoutArchiveAttribute] [-ResetArchiveAttributeAfterSelection] [-FileExcludeFilter <String[]>] [-AttributeIncludeFilter ] [-AttributeExcludeFilter ] [-SetAttributesAfterCopy ] [-RemoveAttributesAfterCopy ] [-MinFileSize ] [-MaxFileSize ] [-MinFileAge ] [-MaxFileAge ] [-MinLastAccessAge ] [-MaxLastAccessAge ] [-RecoveryMode] [-MonitorMode] [-MonitorModeThresholdMinutes ] [-MonitorModeThresholdNrOfChanges ] [-MonitorModeRunHoursFrom ] [-MonitorModeRunHoursUntil ] [-LogFilePath ] [-LogfileOverwrite] [-LogDirectoryNames] [-LogAllFileNames] [-Unicode] [-LargeFiles] [-MultiThreaded] [-CompressibleContent] [[-Override] ] [-WhatIf] [-Confirm] []

Start-RoboCopy [-Source] <String> [[-DestinationDirectory] <String>] [[-Files] <String[]>] [-Mirror] [-Move] [-IncludeSecurity] [-SkipEmptyDirectories] [-CopyOnlyDirectoryTreeStructure] [-CopyOnlyDirectoryTreeStructureAndEmptyFiles] [-SkipAllSymbolicLinks] [-SkipSymbolicFileLinks] [-CopySymbolicLinksAsLinks] [-SkipJunctions] [-CopyJunctionsAsJunctons] [-Force] [-SkipFilesWithoutArchiveAttribute] [-ResetArchiveAttributeAfterSelection] [-FileExcludeFilter <String[]>] [-DirectoryExcludeFilter <String[]>] [-AttributeIncludeFilter <String>] [-AttributeExcludeFilter <String>] [-SetAttributesAfterCopy <String>] [-RemoveAttributesAfterCopy <String>] [-MaxSubDirTreeLevelDepth <Int32>] [-MinFileSize <Int32>] [-MaxFileSize <Int32>] [-MinFileAge <Int32>] [-MaxFileAge <Int32>] [-MinLastAccessAge <Int32>] [-MaxLastAccessAge <Int32>] [-RecoveryMode] [-MonitorMode] [-MonitorModeThresholdMinutes <Int32>] [-MonitorModeThresholdNrOfChanges <Int32>] [-MonitorModeRunHoursFrom <Int32>] [-MonitorModeRunHoursUntil <Int32>] [-LogFilePath <String>] [-LogfileOverwrite] [-LogDirectoryNames] [-LogAllFileNames] [-Unicode] [-LargeFiles] [-MultiThreaded] [-CompressibleContent] [[-Override] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION A comprehensive wrapper for the RoboCopy command-line utility that provides robust file and directory copying capabilities. This function exposes RoboCopy's extensive feature set through PowerShell-friendly parameters while maintaining most of its powerful functionality.

Key Features:
- Directory synchronization with mirror options
- Support for extra long pathnames (>256 characters)
- Restartable mode for resilient copying
- Security settings preservation
- Advanced file attribute handling
- Symbolic link and junction point management
- Monitor mode for continuous synchronization
- Performance optimization for large files
- Network compression support
- Recovery mode for failing devices

PARAMETERS -Source The source directory, file path, or directory with search mask to copy from.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-DestinationDirectory <String>
    The destination directory to place the copied files and directories into.
    If this directory does not exist yet, all missing directories will be created.
    Default value = `.\`
    
    Required?                    false
    Position?                    2
    Default value                ".$([System.IO.Path]::DirectorySeparatorChar)"
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Files <String[]>
    
    Required?                    false
    Position?                    3
    Default value                @()
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  true
    
-Mirror [<SwitchParameter>]
    Synchronizes the content of specified directories, will also delete any files and directories in the destination that do not exist in the source
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Move [<SwitchParameter>]
    Will move instead of copy all files from source to destination
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-IncludeSecurity [<SwitchParameter>]
    Will also copy ownership, security descriptors and auditing information of files and directories
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipDirectories [<SwitchParameter>]
    Copies only files from source and skips sub-directories (no recurse)
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipEmptyDirectories [<SwitchParameter>]
    Does not copy directories if they would be empty
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CopyOnlyDirectoryTreeStructure [<SwitchParameter>]
    Create directory tree only
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CopyOnlyDirectoryTreeStructureAndEmptyFiles [<SwitchParameter>]
    Create directory tree and zero-length files only
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipAllSymbolicLinks [<SwitchParameter>]
    Don't copy symbolic links, junctions or the content they point to
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipSymbolicFileLinks [<SwitchParameter>]
    Don't copy file symbolic links but do follow directory junctions
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CopySymbolicLinksAsLinks [<SwitchParameter>]
    Instead of copying the content where symbolic links point to, copy the links themselves
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipJunctions [<SwitchParameter>]
    Don't copy directory junctions (symbolic link for a folder) or the content they point to
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CopyJunctionsAsJunctons [<SwitchParameter>]
    Instead of copying the content where junctions point to, copy the junctions themselves
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Force [<SwitchParameter>]
    Will copy all files even if they are older then the ones in the destination
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SkipFilesWithoutArchiveAttribute [<SwitchParameter>]
    Copies only files that have the archive attribute set
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-ResetArchiveAttributeAfterSelection [<SwitchParameter>]
    In addition of copying only files that have the archive attribute set, will then reset this attribute on the source
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-FileExcludeFilter <String[]>
    Exclude any files that matches any of these names/paths/wildcards
    
    Required?                    false
    Position?                    named
    Default value                @()
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  true
    
-DirectoryExcludeFilter <String[]>
    Exclude any directories that matches any of these names/paths/wildcards
    
    Required?                    false
    Position?                    named
    Default value                @()
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  true
    
-AttributeIncludeFilter <String>
    Copy only files that have all these attributes set [RASHCNETO]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-AttributeExcludeFilter <String>
    Exclude files that have any of these attributes set [RASHCNETO]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-SetAttributesAfterCopy <String>
    Will set the given attributes to copied files [RASHCNETO]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-RemoveAttributesAfterCopy <String>
    Will remove the given attributes from copied files [RASHCNETO]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MaxSubDirTreeLevelDepth <Int32>
    Only copy the top n levels of the source directory tree
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MinFileSize <Int32>
    Skip files that are not at least n bytes in size
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MaxFileSize <Int32>
    Skip files that are larger then n bytes
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MinFileAge <Int32>
    Skip files that are not at least: n days old OR created before n date (if n < 1900 then n = n days, else n = YYYYMMDD date)
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MaxFileAge <Int32>
    Skip files that are older then: n days OR created after n date (if n < 1900 then n = n days, else n = YYYYMMDD date)
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MinLastAccessAge <Int32>
    Skip files that are accessed within the last: n days OR before n date (if n < 1900 then n = n days, else n = YYYYMMDD date)
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MaxLastAccessAge <Int32>
    Skip files that have not been accessed in: n days OR after n date (if n < 1900 then n = n days, else n = YYYYMMDD date)
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-RecoveryMode [<SwitchParameter>]
    Will shortly pause and retry when I/O errors occur during copying
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MonitorMode [<SwitchParameter>]
    Will stay active after copying, and copy additional changes after a a default threshold of 10 minutes
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MonitorModeThresholdMinutes <Int32>
    Run again in n minutes Time, if changed
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MonitorModeThresholdNrOfChanges <Int32>
    Run again when more then n changes seen
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MonitorModeRunHoursFrom <Int32>
    Run hours - times when new copies may be started, start-time, range 0000:2359
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MonitorModeRunHoursUntil <Int32>
    Run hours - times when new copies may be started, end-time, range 0000:2359
    
    Required?                    false
    Position?                    named
    Default value                -1
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-LogFilePath <String>
    If specified, logging will also be done to specified file
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-LogfileOverwrite [<SwitchParameter>]
    Don't append to the specified logfile, but overwrite instead
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-LogDirectoryNames [<SwitchParameter>]
    Include all scanned directory names in output
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-LogAllFileNames [<SwitchParameter>]
    Include all scanned file names in output, even skipped onces
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Unicode [<SwitchParameter>]
    Output status as UNICODE
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-LargeFiles [<SwitchParameter>]
    Enables optimization for copying large files
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-MultiThreaded [<SwitchParameter>]
    Optimize performance by doing multithreaded copying
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-CompressibleContent [<SwitchParameter>]
    If applicable use compression when copying files between servers to safe bandwidth and time
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Override <String>
    Overrides, Removes, or Adds any specified robocopy parameter.
    
    Usage:
    
    Add or replace parameter:
    
        -Override /SwitchWithValue:'SomeValue'
    
        -Override /Switch
    
    Remove parameter:
    
        -Override -/Switch
    
    Multiple overrides:
    
        -Override "/ReplaceThisSwitchWithValue:'SomeValue' -/RemoveThisSwitch /AddThisSwitch"
    
    Required?                    false
    Position?                    4
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-WhatIf [<SwitchParameter>]
    Displays a message that describes the effect of the command, instead of executing the command.
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
-Confirm [<SwitchParameter>]
    
    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Aliases                      
    Accept wildcard characters?  false
    
<CommonParameters>
    This cmdlet supports the common parameters: Verbose, Debug,
    ErrorAction, ErrorVariable, WarningAction, WarningVariable,
    OutBuffer, PipelineVariable, and OutVariable. For more information, see
    about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

OUTPUTS

-------------------------- EXAMPLE 1 --------------------------

PS > ########################################################################Mirror a directory with security settings
Start-RoboCopy -Source "C:\Projects" -DestinationDirectory "D:\Backup" `
-Mirror -IncludeSecurity






-------------------------- EXAMPLE 2 --------------------------

PS > ########################################################################Monitor and sync changes every 10 minutes
Start-RoboCopy -Source "C:\Documents" -DestinationDirectory "\\server\share" `
-MonitorMode -MonitorModeThresholdMinutes 10

RELATED LINKS https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy https://en.wikipedia.org/wiki/Robocopy





About

A Windows PowerShell module for basic and advanced file management tasks

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •