Last active
May 15, 2023 16:05
-
-
Save Timberfang/84d3dfc962e33156f57bcd5774bda4d3 to your computer and use it in GitHub Desktop.
Find missing numbers in a list of file names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version 3.0 | |
#Requires -Version 7.0 | |
# Find missing numbers in a list of file names containing four digit numbers in parentheses. | |
# Outputs list of missing numbers to pipeline. | |
[System.Int32[]]$Iteration = Get-ChildItem $Path | Where-Object{$_.Name -match "\(\d{4}\)"} | ForEach-Object{$Matches[0]} | |
$Iteration[0]..$Iteration[-1] | Where-Object{$_ -notin $Iteration} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment