Reference number: CH000846
How do I change the name of a file or folder?
Question:
How do I change the name of a file or folder?
Answer:
Below is additional information about how a user can rename a file
or directory in their operating system. Click on one of the below
links to automatically scroll to the operating system you need help
with.
MS-DOS users
Microsoft Windows users
Linux / Unix users
Additional Information
MS-DOS users
MS-DOS users can change the name of a file or directory by using
the ren command or rename command.
Below are some examples of how this command can be used. Additional
information about each of these commands can be found by clicking
the above command links.
Renaming a file
In the below example this would rename the file test.txt to
hope.txt.
rename test.txt hope.txt
If the test.txt file was in a different directory then the one
you were currently in you would need to specify the path of the
file. For example, if the file was in the "computer" directory you
would type a command similar to the below example.
rename c:\computer\test.txt hope.txt
Renaming multiple files with one command
To rename multiple files at once you must utilize some form of
wild character, below are
some examples of how this could be done.
In the below example this would rename all the files in the
current directory that end with .rtf to .txt files.
rename *.rtf *.txt
In this next example the command would rename a file with an
unknown character in the file name to something that can be read.
The "?" used in the below example is the wild character for an
unknown character.
rename h?pe.txt hope.txt
Renaming a directory
Renaming a directory in MS-DOS is much like renaming a file
simply use the ren or rename command to rename the directory.
Because you cannot have a file and directory that have the same
name you will not need to worry about mistakenly renaming a file
instead of a directory, unless you're using wild characters.
In the below example this would rename the computer directory to
hope.
rename computer hope
Microsoft Windows users
Renaming a file or folder
Windows users can rename their files and directories by using
one of the below methods. We've listed the below recommendations in
what we believe to be the easiest methods of renaming a file.
First recommendation:
- Highlight the file
or folder you wish to rename.
- Right-click the file
and click Rename from the menu that appears.
Second recommendation:
- Highlight the file
or folder you wish to rename.
- Click File at the top of the Window and select Rename from
the list of available options.
Third recommendation:
- Highlight the file
or folder you wish to rename by single-clicking the file.
- Once highlighted wait a few seconds and click the file
again. A box should appear surrounding the file or folder name
and you should be able to rename the file.
Note: If you don't wait long enough and click the
file or folder to fast it will open the file or folder.
Renaming multiple files or folders at once
- Open Explorer.
- In Explorer select all the files you wish to rename.
Additional information about how to select multiple files can
also be found on
document CH000771.
- Once the files have been selected press F2 and type the new
name for the files. For example, typing "test" will rename the
files to test, test(1), test(2), test(3) etc. If you have
file extensions
shown make sure to also type the name of the file extension
you're renaming.
Microsoft Windows users can also used the steps mentioned above
MS-DOS section to rename their files and directories. Additional
information about getting to a MS-DOS prompt can be found on
document CHDOS.
Linux / Unix users
Linux and Unix users can rename their files and directories by
using the mv command. Below are some
additional examples of how this command can be used. Additional
information about this command can also be found on the above
command link.
Renaming a file
In the below example this would rename the file test.txt to
hope.txt.
mv test.txt hope.txt
If the test.txt file was in a different directory then the one
you were currently in you would need to specify the path of the
file. For example, if the file was in the "computer" directory you
would type a command similar to the below example.
mv computer/test.txt hope.txt
Renaming multiple files or directories at once
To rename multiple files at once you must utilize some form of
wild character, below are
some examples of how this could be done.
In the below example this would rename all the files in the
current directory that end with .rtf to .txt files.
mv *.rtf *.txt
In this next example the command would rename a file with an
unknown character in the file name to something that can be read.
The "?" used in the below example is the wild character for an
unknown character.
mv h?pe.txt hope.txt
Renaming a directory
Renaming a directory in Linux / Unix is much like renaming a
file simply replace the file name with the directory name that you
wish to rename. For example, if we wanted to rename the directory
"test" to "hope" you would type the below command.
mv test hope
Additional information:
|