file : add scandirNotSorted function

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2984 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-08-03 08:16:13 +00:00
parent ad556454a4
commit 7923f40dd7

View File

@@ -405,6 +405,23 @@ class file
return $res;
}
/** Return the list of files and directories in the directory.
* Do not return the . and .. virtual dirs.
* The result is NOT sorted
* @param string $directory The directory to read
* @return array the list of files and dirs
* @throws If directory not exists, or is not executable
*/
public function scandirNotSorted ($directory)
{
$this->debug (2, "scandirNotSorted ($directory)");
$directory = $this->realpath ($directory);
$this->checkPathRO ($directory);
$res = array_values (array_diff (scandir ($directory, SCANDIR_SORT_NONE),
array('..', '.')));
return $res;
}
/** Create a new file or update the timestamp if the file exists
* @param string $filename the filename
* @param int $time the timestamp to use (actual timestamp if not defined)