Get one step file and folder list in a folder.
App::Utility()->getDirLising(Path,[Option])
Parameter |
Description |
---|---|
Path |
File path |
Option |
Get file create time in index "filetime_as_index" |
See bellow example:
//Example 1:
$data = App::Utility()->getDirLising(App::Config()->baseDir());
pre($data);
//Example 2:
$data = App::Utility()->getDirLising(App::Config()->baseDir(),array('filetime_as_index'=>true));
pre($data);
/*
Output 1
Array
(
[file] => Array
(
[0] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => .htaccess
[type] => file
[filemtime] => 1353482096
)
[1] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => abc.txt
[type] => file
[filemtime] => 1366209127
)
[2] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => cron.php
[type] => file
[filemtime] => 1337736924
)
[3] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => index.php
[type] => file
[filemtime] => 1337736922
)
[4] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => LICENSE.txt
[type] => file
[filemtime] => 1355848036
)
[5] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => php.ini.sample
[type] => file
[filemtime] => 1301800636
)
[6] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => test.txt
[type] => file
[filemtime] => 1366258932
)
)
[dir] => Array
(
[0] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => addons
[type] => dir
[filemtime] => 1364989930
)
[1] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => componentroot
[type] => dir
[filemtime] => 1364989930
)
[2] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => images
[type] => dir
[filemtime] => 1362646906
)
[3] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => install
[type] => dir
[filemtime] => 1364989930
)
[4] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => js
[type] => dir
[filemtime] => 1364989930
)
[5] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => themeroot
[type] => dir
[filemtime] => 1364989930
)
[6] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => uploads
[type] => dir
[filemtime] => 1366260247
)
)
)*/
/*
Output 2
Array
(
[file] => Array
(
[1353482096] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => .htaccess
[type] => file
[filemtime] => 1353482096
)
[1366209127] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => abc.txt
[type] => file
[filemtime] => 1366209127
)
[1337736924] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => cron.php
[type] => file
[filemtime] => 1337736924
)
[1337736922] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => index.php
[type] => file
[filemtime] => 1337736922
)
[1355848036] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => LICENSE.txt
[type] => file
[filemtime] => 1355848036
)
[1301800636] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => php.ini.sample
[type] => file
[filemtime] => 1301800636
)
[1366258932] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => test.txt
[type] => file
[filemtime] => 1366258932
)
)
[dir] => Array
(
[1364989930] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => themeroot
[type] => dir
[filemtime] => 1364989930
)
[1362646906] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => images
[type] => dir
[filemtime] => 1362646906
)
[1366260247] => Array
(
[dir_path] => D:\xampp\htdocs\works\app\projects\express/webroot
[name] => uploads
[type] => dir
[filemtime] => 1366260247
)
)
)
*/