The following code:
<?php
function listContents(){
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
};
// current directory
echo getcwd() . "\n";
chdir('blogs');
// current directory
echo getcwd() . "\n";
listContents();
$output= rmdir('May 2006');
echo "<pre>$output</pre>";
listContents();
?>
results in this output:
/home/epicambl/public_html /home/epicambl/public_html/blogs
total 28
drwxrwxrwx 2 epicambl epicambl 4096 May 1 15:37 04 Apr 2006
drwxrwxrwx 2 epicambl epicambl 4096 May 31 04:29 05 May 2006
drwxr-xr-x 2 nobody nobody 4096 Jun 3 00:26 06 Jun 2006
drwxr-xr-x 2 nobody nobody 4096 Jun 3 00:27 May 2006
drwxr-x--- 9 epicambl nobody 4096 Jun 3 01:34 ..
drwxr-xr-x 2 nobody nobody 4096 Jun 3 01:46 06 Jun 2006
drwxrwxrwx 7 epicambl epicambl 4096 Jun 3 01:46 .
Warning: rmdir(May 2006) [function.rmdir]: No such file or directory in /home/epicambl/public_html/shell.php on line 25
Note that the directory is listed by the ls function but the rmdir function returns a directory not found function.