Move / Rename a File or Directory

used to either rename or move files or directories

rename(source, target);

 

<?php
	$fileName = "/home/d/myFile.txt" ; //specify file name

	$newName = $filename . "/home/d/renamed.txt" ;

	rename($fileName, $newName) ;

?>

*make sure permissions and path are correct

Leave a Reply