Reference number: CH000428
Changing a file
extension.
Issue:Changing a file extension.
Cause:
It may be necessary to change the file extension to open the
file or files with a different application or in a different method.
Solution:It is important to realize that while
you may be able to rename a file, it may or may not be able to be
opened in the application used to open the new file extension. A good
example would be renaming a batch file (.BAT) to a .EXE. Because a
.EXE file needs to be compiled, you will now receive an error when
attempting to open the file.
Below is a listing of how to change
the file extension for each of the major IBM compatible operating systems:
MS-DOS users
Additional information about how to get into MS-DOS can be
found on document CHDOS.
Change the directory to the location of where the file is located.
In our below example we will rename the file myfile.txt to myfile.doc.
move myfile.txt myfile.doc
Unless the file already exists you should receive an [ok] message
indicating that the file has been renamed.
Additional help and information about move can be found on our move
page.
Renaming multiple file extensions
If you wish to rename multiple files that have the same file
extension without the aid of a different program we recommend you
follow the below steps.
The below example will rename all the files in the
current directory that end with ".txt" to
".old".
ren *.txt *.old
See our ren or rename page for
additional information about this command.
Windows users
Before renaming a Windows file extension you must have set
Windows to display file extensions. By default this option is
disabled. Additional information and help with viewing the file
extensions can be found on document CH000573.
Using the same examples as we did earlier, assuming the file is named myfile.txt, we will rename it
to myfile.doc.
- right-click on the file (not the shortcut)
- Click Rename
- Erase the .txt from myfile.txt.
- Type .doc (it is important to have the dot).
Renaming multiple file extensions
If you wish to rename or change the file extensions of multiple
files we recommend you enter MS-DOS from Windows and use the above
MS-DOS steps.
Unix / Linux users
Change to the directory to the location of where the file is
located. In our below example we will rename the file myfile.txt to
myfile.htm. Additionally, this example is done from the shell and not a
GUI.
mv myfile.txt myfile.htm
Unless an error occurs you should be returned back to the shell
prompt
Additional help and information about mv can be found on the mv
page.
|