Snippets for getting the old name in name change scripts, sanitizing filenames for Windows, and renaming files.

This commit is contained in:
Pat Hartl 2023-03-17 02:08:59 -05:00
parent 8c1e08d49f
commit ac8773c363
3 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1 @@
Rename-Item -Path "$InstallDir\<FilePath>" -NewName "$InstallDir\<NewName>"

View file

@ -0,0 +1,2 @@
# Takes the variable $Filename, splits it by invalid characters, then joins using _
$Filename.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'

View file

@ -0,0 +1,4 @@
$OldName = ""
if ($args[1]) {
$OldName = $args[1]
}