Windows 10 – How to Change File Extensions of Existing Files Simultaneously

file extensionrenamewindows 10

Is there a way to change the file extensions of existing files (inside a folder) simultaneously?

I have a folder and within are different subfolders (nested). All the files are .txt, and I want to change them all to .md.

Is there a way to change those simultaneously, or do I really need to modify them one by one? 🙁

Thanks,
Faye

Additional questions:

@user1016274 : Thanks. By the way, will it also work with files with no extensions? I haven't tried it yet, but I discovered just now that some folders have files with no extension. Pls see the image I added (above), pls see it. Thanks.

enter image description here

Best Answer

The rename command allows for a wildcard:
rename *.txt *.md would rename all files in one call, in the current directory.

Now you just need to traverse all directories down from the root dir. For this, there is a for command:
cd /d <rootdir> & for /R %d in (.) do @echo %d

Putting it all together:

cd /d <rootdir>
for /R %d in (.) do @rename "%d\*.txt" *.md
Related Question