PHP provides a variety of functions and features for interacting with the file system like copying, renaming and deleting a file. Here's a brief overview of the opertions can be performed in PHP:
The copy() function is used to copy a file in PHP.
<?php
copy($sourceFilePath, $destinationFilePath);
?>
<?php
$sourceFile = 'path/sourceFile.php';
$destinationFile = 'path/destinationFile.php';
copy($sourceFile, $destinationFile);
?>
The rename() function is used to rename a file in PHP.
<?php
rename($oldFilePath, $newFilePath);
?>
<?php
$oldFilePath = '/oldPath/file.php';
$newFilePath = '/newPath/file.php';
rename($oldFilePath, $newFilePath);
?>
The unlink() function is used to delete a file in PHP.
<?php
bool unlink ( string $filename [, resource $context ] )
?>
<?php
unlink('test.php');
?>
PHP File System allows us to create file, read file line by line, read file character by character, write file, append file, delete file and close file.