Hi,
I need a function that can entirely remove a directory content (all subdirectories and files)
I think CFileHelper::findFolders() is missing
And why not a CFileHelper::emptyDir(); (to quickly empty a directory content) (for an easy removal of uploaded files)
Page 1 of 1
CFileHelper::findFiles()
#1
Posted 09 April 2012 - 07:09 AM
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
#3
Posted 09 April 2012 - 07:38 AM
Here is a nice function i found for emptying a directory :
It works well
public function emptyDir($dir,$DeleteMe=false) {
if(!$dh=@opendir($dir))
return;
while(false!==($obj=readdir($dh)))
{
if($obj=='.'||$obj=='..')
continue;
if(!@unlink($dir.'/'.$obj))
$this->emptyDir($dir.'/'.$obj,true);
}
closedir($dh);
if($DeleteMe)
{
@rmdir($dir);
}
}
It works well
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
#4
Posted 09 April 2012 - 10:05 AM
Also a new option for findFiles() is needed.
Return or not, the full path to the files to avoid results like this :
Return or not, the full path to the files to avoid results like this :
Array
(
[0] => /var/www/protected/../images/originals/0se01wrb3q.jpg
[1] => /var/www/protected/../images/originals/16cifp07v5.jpg
[2] => /var/www/protected/../images/originals/1qwhxyni22.jpg
[3] => /var/www/protected/../images/originals/1vwcjwyzbp.jpg
[4] => /var/www/protected/../images/originals/1xqtioxrxh.jpg
[5] => /var/www/protected/../images/originals/2c5ffdlzkv.jpg
[6] => /var/www/protected/../images/originals/2hq60vu5j9.jpg
[7] => /var/www/protected/../images/originals/2zcxwzvxvs.jpg
[8] => /var/www/protected/../images/originals/4afd78c2ub.jpg
[9] => /var/www/protected/../images/originals/4pu0gm1aj8.png
[10] => /var/www/protected/../images/originals/6jxgd941hd.jpg
);
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
Share this topic:
Page 1 of 1

Help














