VOOZH about

URL: https://www.geeksforgeeks.org/perl/perl-rename-function/

⇱ Perl | rename() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Perl | rename() Function

Last Updated : 25 Jun, 2019
rename() function in Perl renames the old name of a file to a new name as given by the user.
Syntax: rename(old_file_path, new_file_path) Parameters: old_file_path: path of the old file along with its name new_file_path: path of the new file along with its name Returns 0 on failure and 1 on success
Example: Output: Original File:   πŸ‘ Image
Running the Command:   πŸ‘ Image
Updated File:   πŸ‘ Image
  Steps to Run the above code: Step1: Create a file anywhere in your System and copy the File Path. Step 2: Provide the path of your File in the code above and save it as .pl extension. Step 3: Run the above code in Command line as perl Filename.pl. Step 4: Name of the File is now changed with the new name provided.
Comment
Article Tags:

Explore