Remove-InvalidFileNameChars
1.5.1
Remove-InvalidFileNameChars accepts a string and removes characters that are invalid in Windows file names. It then outputs the cleaned string. By default the space character is ignored, but can be included using the RemoveSpace parameter.
The Replacement parameter will replace the invalid characters with the specified string. Its companion RemoveOnly will exempt g
The Replacement parameter will replace the invalid characters with the specified string. Its companion RemoveOnly will exempt g
Remove-InvalidFileNameChars accepts a string and removes characters that are invalid in Windows file names. It then outputs the cleaned string. By default the space character is ignored, but can be included using the RemoveSpace parameter.
The Replacement parameter will replace the invalid characters with the specified string. Its companion RemoveOnly will exempt given invalid characters from being replaced, and will simply be removed. Charcters in this list can be given as a string or their decimal or hexadecimal representation.
The Name parameter can also clean file paths. If the string begins with "\\" or a drive like "C:\", it will then treat the string as a file path and clean the strings between "\". This has the side effect of removing the ability to actually remove the "\" character from strings since it will then be considered a divider.
Show more
The Replacement parameter will replace the invalid characters with the specified string. Its companion RemoveOnly will exempt given invalid characters from being replaced, and will simply be removed. Charcters in this list can be given as a string or their decimal or hexadecimal representation.
The Name parameter can also clean file paths. If the string begins with "\\" or a drive like "C:\", it will then treat the string as a file path and clean the strings between "\". This has the side effect of removing the ability to actually remove the "\" character from strings since it will then be considered a divider.
Installation Options
Owners
Copyright
2016 Chris Carter
Package Details
Author(s)
- Chris Carter
Tags
RegularExpression StringFormatting InvalidFileNameCharacters
Functions
Remove-Chars Remove-ExemptCharsFromReplacement
Dependencies
This script has no dependencies.
Release Notes
The parameter RemoveOnly has been added. This will exempt certain characters from being replaced with the Replacement string, and they will simply be removed.
FileList
- Remove-InvalidFileNameChars.nuspec
- Remove-InvalidFileNameChars.ps1
Version History
Version | Downloads | Last updated |
---|---|---|
1.5.1 (current version) | 1,267 | 8/16/2016 |
1.4 | 79 | 3/7/2016 |