Deleting Large Number of files

Today i have written a PHP script to delete large number of files on a folder. The folder contains too many files with extension .dat. These files are mail storage of HiveMail script. The folder size was 37 GB. The mail service is stoped as the HiveMail is overkilling the server, mainly because it use a catch all email account.

When i try to delete files with rm -rf command on SSH putty get closed. So i write a simple PHP file to delete all files in the folder.

            <?php
            if ($handle = opendir(\'/home/bizhatc/mailbox\')) {
            while (false !== ($file = readdir($handle))) {
            $file = "/home/bizhatc/mailbox/" . $file;
            unlink ("$file");
            echo "$file";
            }
            closedir($handle);
            }

            ?>
            

Get in touch with us

Questions? Concerns? Comments? We want to hear from you!
Drop us a line with whatever is on your mind and we will get back to you ASAP!!