-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarmup1.php
42 lines (37 loc) · 912 Bytes
/
warmup1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/** CLI FILE **/
function d($dir)
{
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir.DIRECTORY_SEPARATOR.$value))
{
$result[$value] = d($dir.DIRECTORY_SEPARATOR.$value);
}
else
{
$result[] = $value;
}
}
}
return $result;
}
switch (true)
{
case (isset($argv[1]) &&
is_dir($argv[1])):
echo "Dir: ".print_r(d($argv[1]),true)."\n\n";
break;
case (isset($argv[1]) && $argv[1] == "-h"):
default:
echo "usage: php warmup1.php [arguments]\n";
echo "\n";
echo "Arguments\n";
echo "-h Show this help screen\n";
echo "<directory> Two numbers to be summed.\n";
echo "\n";
}