Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename files having no extension

How can we rename all files in a folder having no extension at all to ".something". I have tried ren *.* *.jpeg and few more but nothing working

like image 473
Rishabh Avatar asked Dec 03 '22 11:12

Rishabh


1 Answers

* matches any extension. You want to match no extension, so don't supply one: ren *. *.jpeg.

The above only works in cmd -- PowerShell's wildcards work differently, and mostly don't do anything special with extensions. What's more, batch renaming in PowerShell works differently. So:

dir -Filter "*." -File | ren -NewName { $_.name -replace "$", ".jpeg" }
like image 179
Jeroen Mostert Avatar answered Dec 11 '22 08:12

Jeroen Mostert