Powershell scripts for Sharepoint 2010
$file = "this*file\\i?.txt"
$file
$pattern = "[{0}]" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidFileNameChars()))
$newfile = [Regex]::Replace($file, $pattern, '-')
$newfile
illegal | characters | regex | filename | invalid filename
© 2012 All rights reserved.