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 and Windows command line users

MS-DOS and Windows command line users can change the name of a file or directory by using the ren or rename command. Below are some examples of how this command can be used.

Renaming a file

In the below example this would rename the file test.txt to success.txt.

rename test.txt success.txt

Renaming multiple files with one command

In the below example this would rename all the files in the current directory that end with .jpg to .png files.

rename *.jpg *.png

Renaming a directory

Renaming a directory in MS-DOS is much like renaming a file 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 success.

rename computer success

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.

Renaming a file

In the below example this would rename the file test.txt to success.txt.

mv test.txt success.txt

Renaming multiple files or directories at once

In the below example this would rename all the files in the current directory that end with .jpg to .png files.

mv *.jpg *.png

Renaming a directory

Renaming a directory in Linux / Unix is much like renaming a file replace the file name with the directory name that you wish to rename. For example, if we wanted to rename the directory “test” to “success” you would type the below command.

mv test success