Yes, those three lines of code do works, but not the way you seem to expect them to.
Each of the variables $fichiers, $Name, and $New is an array. However, the code in your Replace-Item is using a regular expression and the $Name and $New variables must be scalars (e.g. a string).
Your code also makes a risky assumption that all the file names (excluding the suffix and the "." that separates the name from the suffix) exceed five characters in length. You run the risk of renaming a file like "123.jpg" to just "pg".
Another risk is that you use Get-Item first and then Get-ChildItem, assuming that 1) the results will be returned in the same order, and 2) that nothing will ever change between the execution of the two cmdlets. It may be unlikely to happen, but it doesn't hurt to code defensively.
I'd suggest amending the code in the answer given by @Andreas Baumgarten to:
Get-ChildItem -Path Junk/3/*.jpg |
ForEach-Object {
if ($_.BaseName.Length -gt 5){
$Name = ($_.Name).Substring(5)
$_ | Rename-Item -NewName $Name
}
}
Now you'll at least have a usable file name, even if it's only one character long. Which leads to another problem . . . by shortening the file name it's possible that you try to rename a file to one that already exists.
If you're just now learning PowerShell, I suggest you download this PDF and read at least the 1st half of the book. Windows-PowerShell-4