The following code removes the !
from all the .txt
files.
get-childitem *.txt | ForEach {Move-Item -LiteralPath $_.name $_.name.Replace("!","")}
I need to do this not only for the !
character but also for #
, ,
, ~
, among others. My intention is to get a code that has the following rule: any character other than [a-z]
and also [0-9]
must be removed from the file names.