File System Reference In PHP
The unlink() function deletes a file.
This function returns TRUE on success, or FALSE on failure.
Syntax
| unlink(filename,context) |
| Parameter | Description |
|---|---|
| filename | Required. Specifies the file to delete |
Example
<?php
$file = “newfile.txt”;
if (!unlink($file))
{
echo (”Error deleting $file”);
}
else
{
echo (”Deleted $file”);
}
?>
Definition and Usage
The rmdir() function removes an empty directory.
This function returns TRUE on success, or FALSE on failure.
Syntax
| rmdir(dir,context) |
| Parameter | Description |
|---|---|
| dir | Required. Specifies the directory to be removed |
Example
<?php
$path = “include”;
if(!rmdir($path))
{
echo (”Could not remove $path”);
}
?>
Related posts:
- working with directories using php
- Find Absolute Path Of A File Or Directory Using PHP
- Simple file upload script using php
- Context Right Click Menu Using Javascript
- Fix the problem in getting 500 Internal Server Error In Localhost Due To .htaccess
- Finding size of a directory using php
- Search Plugin
