Created
October 24, 2022 08:18
-
-
Save sannae/c122f99b4dd3cf4d023324496c7fc0d6 to your computer and use it in GitHub Desktop.
The script renames all the files (found recursively from a root path) whose filename matches the pattern specified
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
# Root folder | |
$Path = "\YOUR-PATH-HERE" | |
# Regex pattern (in this example, something like "(2022_10_10 08_30 UTC)" | |
$pattern = ".[0-9]+_[0-9]+_[0-9]+ [0-9]+_[0-9]+ UTC." | |
foreach ($file in $(get-childitem $Path -Recurse) ) { | |
if ($file.Name -match $pattern){ | |
Rename-iTem $File.FullName $($($file.FullName).Replace($Matches[0],"")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment