How to Change a File Name in Perl
Perl is an open source programming language available for all operating systems. It can also be used as a command line scripting language. That means that you can issue perl commands from a command prompt. The perl functions are the same across all operating systems. So, if you know how to change a file name in one operating system using perl, you can change a file name in any other operating system.
Instructions
-
-
1
Open a terminal window on Linux or Unix operating systems or a command prompt window on the Windows operating system.
-
2
Navigate to the directory that contains the file you want to change.
-
-
3
Type the command "perl -e 'rename ("original.txt", "new.txt")'" to change the file name from "original.txt" to "new.txt."
-
4
Type the command "ls" in Linux or Unix or the command "dir" in Windows to list the files in the directory and ensure that the file was renamed correctly.
-
5
Type the command "exit" to close the terminal window or command prompt window.
-
1
Tips & Warnings
The "rename" function can also be used within larger perl script (program).