7

If I have a bunch of files with one file extension, is there a way to quickly change them to another file extension without having to manually change one file at a time? The Microsoft support page gives a method for quickly renaming many files, but it only changes the names and keeps the original extensions, even if I have the option set to show file extensions when renaming a file.

0

4 Answers 4

24

You have a few utilities available.

Powershell

Use Rename-Item in combination with Get-ChildItem

Get-ChildItem "*.png" | Rename-Item -NewName { $_.Name -replace "\.png$",".jpg" }

Command prompt

Use the ren command

ren *.png *.jpg

Power Rename

The Power Rename utilty of PowerToys.

  • Set the current extension, then the extension to change to.
  • Apply to: Extension only
  • Click Apply

Note: This assumes that you are on the folder where the files are located. If not, you need to cd to the correct locations for the first two examples.

6
  • 2
    +1 power rename is a great solution.
    – Sam Rueby
    Commented Jan 9 at 16:02
  • Shouldn't there be quotes around the * in the ren commandline?
    – allo
    Commented Jan 9 at 19:07
  • 3
    @allo I just tested it, and the quotes are not necessary, even if the filename itself has spaces. I believe you would need the quotes in Linux, though.
    – trlkly
    Commented Jan 9 at 22:28
  • 5
    @allo, in DOS, glob expansion is done by the program being run, unlike Linux, where glob expansion is done by the shell.
    – Mark
    Commented Jan 10 at 2:32
  • 2
    The pattern ".png" for the PowerShell -replace is not quite correct. -replace expects a Regular Expression as pattern, where . stands for any character, not the literal ., so it must be escaped to avoid unexpected results. And since only the extension is to be changed, the pattern should also be anchored to the end of the string: { $_.Name -replace "\.png$", ".jpg" }. Doesn't matter too much with "png", but if someone reads this and, for example, tries to rename .gif to .jpg, then "My gifted child.gif" would become "My.jpgted child.jpg".
    – user314159
    Commented Jan 11 at 7:23
0

You can also use the GUI program ant renamer which has a portable version and can be run from a USB stick.

0

There is the online tool https://batch-edit.com that is able to do this for multiple files at once.

Concretely, you can add the "Rename File" Operator between the "Read" and the "Write" step. Make sure to enable both the regex option, as well as including the file extension in the renaming process. For the pattern use the regex \.\w+ to match file extensions. Enter your desired file extension as the replacement. Click run and download your files with the new extension.

Disclaimer: I'm the author of the tool.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 8 at 11:32
-2

Very Easy in this video, please watch

https://www.youtube.com/watch?v=eeDVLR-2W6s

2
  • Welcome to Super User! Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Commented Jun 14 at 7:10
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Dominique
    Commented Jun 14 at 7:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .