Suppose you have a directory with corrupted file names. You just know that they are all files. png, but the extensions have been switched to random names. You would then like to rename everything to . png, at once.
Using Windows Powershell:
dir | % {ren $_ ($_.name.substring(0, $_.name.length-4) + ‘.png’ ) }
The first command, dir, gets a list of files from the current directory and passes objects (not text!) to the next command in the pipeline. The next one (the % means foreach-Object) executes the block (between { e } ) for each item.
In this case, the Rename command ($_)
and the new name ($_.name.substring(0, $_.name.length-4) + ‘.png’ )
Source: http://www.purainfo.com.br/programacao-scripts/power-shell/renomando-arquivos-em-massa-pelo-power-shell/
Good evening Ricardo, we are discussing this question here http://meta.pt.stackoverflow.com/q/4516/3635
– Guilherme Nascimento
Looks like I was wrong +1
– Guilherme Nascimento