I’m trying to rename some files. In the path and filename there are symbols like [, ] and spaces. The rename command says it can´t find the file.
There is a main file with the symbols and a "temp" file. The main file should be deleted and the name of the temp file should be from the original.
my code is:
$onlypath = Split-Path -Path $_.FullName Rename-Item $onlypath + "\TEMP" $_.Name and testet many other syntax like
Rename-Item -Path "$onlypath\TEMP" -NewName $_.Name or Rename-Item -Path $onlypath"\TEMP" -NewName $_.Name or Rename-Item -Path $onlypath + "\TEMP" -NewName $_.Name the error is everytime, that the file is not at this place. i tried the command in a shell and the same error but if i add ` as escape char before the symbols it works.
greetings