User Tools

Site Tools


uphp:functions:rmdir

rmdir

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Remove a directory, with optional deletion of contents

Description

int rmdir ( string $pathname [, int $delete_contents ] )

This function attempts to remove a directory as specified by the pathname

Parameters

$pathname: The directory path. Using a / at the beginning will make it relative to the root, otherwise it will be relative to the current working directory, which is either the folder that the script was started in or as was set by chdir().

$delete_contents: Optional

  • 0 - The function will fail if the folder is not empty. (This is the default if this parameter is not specified).
  • 1 - The function will force deletion of everything below the path.

Return Values

Integer: 0 on success or -1 on failure

Example

<?
  if (rmdir("/mypath/")==0) print("Directory removed!");
?>

See Also

chdir() - Change the current directory

getcwd() - Get the current directory

mkdir() - Make a directory

unlink() - Remove a file (delete it)

uphp/functions/rmdir.txt · Last modified: 2021/09/13 05:57 (external edit)