34.204.169.76 |    

Navigation

Google Advertisement

This function delete directory recursive.

rmdir_recursive
  1. // if ( rmdir_recursive( '/var/www/php' ) ) {
  2. // 		echo "Directory -/var/www/php- deleted";
  3. // }
  4. //
  5. // *****************************************************************
  6. // This function delete a directory and the files within.
  7.  
  8. function rmdir_recursive ( $path ) {
  9.  
  10. if ( is_dir( $path ) ) {
  11. 	if ( $handle = opendir( $path ) ) {
  12. 		while ( false !== ( $file = readdir( $handle ) ) ) {
  13. 			if ( $file != '.' && $file != '..' )
  14. 				unlink( $path."/".$file );
  15. 		}
  16. 		closedir( $handle );
  17. 		rmdir( $path );
  18. 		return 1;
  19. 	}
  20. }
  21. return;
  22.  
  23. }
Parsed in 0.016 seconds at 33.17 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 3 users online.

Tags Cloud

Latest snippets
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)
STDERR
(Bash::Function)
radius
(CSS)
shadow
(CSS)
rotate
(CSS)
create_function
(JavaScript::Snippets)