Warning: rmdir(..): Directory not empty

Last update on August 29, 2009 08:54 AM by jak58
Published by netty5

Warning: rmdir(..): Directory not empty








If you are attempting to delete a PHP file and that you get the error message:

Warning: rmdir(..): Directory not emptyť. 



This might mean that the directory is not empty. To be able to erase those files that are in the directory, there is a special PHP code that you can use in both the subfolders and the folders.
<? 

        rmdir_recursive function ($ dir) 
         ( 
         / / List the contents of the directory table 
         $ Dir_content = scandir ($ dir); 
              / / Is it a directory? 
                  If ($ dir_content! == FALSE) {
                       / / For each directory entry 
                             Foreach ($ dir_content as $ entry) 
                                ( 
                                 / / Unix symbolic shortcuts, we go 
                                  If (! In_array ($ entry, array ('.','..'))){ 
                                / / We find the path from the beginning 
                                $ Entry = $ dir. '/'. $ entry; 
                       / / This entry is not an issue: it clears 
                 If (! Is_dir ($ entry)) ( 
         Unlink ($ entry); 
         ) 
    / / This entry is a folder, it again on this issue 
   Else ( 
  Rmdir_recursive ($ entry); 
                                         } 
                             } 
                }
} 
/ / It has erased all entries in the folder, we can now erase 
Rmdir ($ dir); 
} 
?>
Best answers for « Warning: rmdir(..): Directory not empty » in :
Directory Show What is a directory? A directory (also known as a folder) is an IT element that can contain files. Imagine a large dresser containing drawers in which files or other drawers are stored. A directory can in fact contain: files other...
[MS-Dos]List the contents of a directory in a file Show [MS-Dos]List the contents of a directory in a file Intro Explanation Intro It may be convenient to make the listing of one or more directories in a file, to make a catalog of files. Under MS-DOS (or Windows by opening a...
Creating an empty file Show Creating an empty file To create an empty file, type the following command: > file You can also use the touch command: touch file
Cleaning .thumbnails directory ShowCleaning .thumbnails directory Most desktop applications used under linux are able to display thumbnails of images stored on your PC. To quicken the display of these images, Linux tend to store them. The problem with these thumbnails...
[Command Prompt]Empty spaces not supported Show[Command Prompt]Empty spaces not supported Issue Solution Issue You want to make a command that targets a specified path, but it includes a space on a file. Example: You want to make a copy from one directory to another:...
Access to an FTP server as if it were a local directory ShowAccess to an FTP server as if it were a local directory Install Curlftpfs : sudo aptitude install curlftpfs Create the directory for FTP server: mkdir mountpoint Add authorized users to use the software(fuse group): sudo...
Download Remove Empty Directories ShowRemove Empty Directories or RED is a free software intended to abolish the empty files. RED searches and abolishes the empty files by showing by a tree-like aspect the way of access to the file. You can create certain rules to be able to keep a...
Download Empty Temp Folders ShowAfter some days of use the PC is already full of temporary files which are not necessary but voluminous. You must delete them in order to get more space disk. Empty Temp Folders is a software which allows to delete all the default stored temporary...
File sharing in Windows XP ShowAdvantages File sharing involves making the content of one or more directories available through the network. All Windows systems have standard devices making it easy to share the content of a directory. However, file sharing may lead to security...
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...
Linux - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence the name "shell". The shell therefore acts as an intermediary between the operating system and the user thanks to command lines...