How to quickly replace the file extensions of several files

No comments
Sometimes it may be necessary to change the extensions of several files to allow compatibility with a particular program. For example you may need to change the extension of all the asp files in a folder to htm. If there are plenty of files in your folder it would be a very tedious work to do. But with a little command magic you can do the job in just a few steps.
For this example we will change all the files with an *.asp extension to a *.htm files.
If you want to keep the original files just in case use the below command at the CMD prompt or within a batch file:

xcopy *.asp *.htm
This would create a copy of all files with .asp extension and rename them to .htm, while keeping the original files.

If you simply wish to rename the extensions without keeping the original file you can just replace xcopy command to rename as below example.
rename *.asp *.htm

What if your files do not have any extension at all (there are programs that come in archives with text files that do not have extensons). For example if you want to add txt extension to all files in a folder open command prompt (win + R / cmd), navigate to your folder than enter the below command.

ren * *.jpg

No comments :

Post a Comment