Rename Files in PHP

Renaming Files:
Like the copy() function, the rename() function just needs to know the original filename and a new filename. In this case, you’re just renaming the original, not copying it

Example:
<?php
$org_file = “e:/ashu.old”;
$new_file = “e:/ashu.txt”;
$success = rename($org_file, $new_file) or die(“Unable to rename file”);
if($success)
{
$msg = “Rename $org_file to $new_file”;
}
?>
<?
echo $msg;
?>

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Leave a Reply

Your email address will not be published. Required fields are marked *