|
Revision 18784, 0.8 kB
(checked in by joshiausdemwald, 4 years ago)
|
Initial commit
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/usr/bin/php -q |
|---|
| 2 |
<?php |
|---|
| 3 |
$dirs = array(); |
|---|
| 4 |
for($i=1; $i<count($_SERVER['argv']); $i++) |
|---|
| 5 |
{ |
|---|
| 6 |
$dirs[] = $_SERVER['argv'][$i]; |
|---|
| 7 |
} |
|---|
| 8 |
$log = fopen(dirname(__FILE__) . '/files.txt', 'w+'); |
|---|
| 9 |
|
|---|
| 10 |
foreach($dirs AS $dir) |
|---|
| 11 |
{ |
|---|
| 12 |
$dir = dirname(__FILE__) . '/' . $dir; |
|---|
| 13 |
iterate($dir); |
|---|
| 14 |
} |
|---|
| 15 |
function iterate($dir) |
|---|
| 16 |
{ |
|---|
| 17 |
global $log; |
|---|
| 18 |
foreach(new RecursiveDirectoryIterator($dir) AS $file) |
|---|
| 19 |
{ |
|---|
| 20 |
if($file->isDir()) |
|---|
| 21 |
{ |
|---|
| 22 |
if(strpos($file->getFilename(), '.') !==0 ) |
|---|
| 23 |
{ |
|---|
| 24 |
|
|---|
| 25 |
iterate($file->getPathname()); |
|---|
| 26 |
} |
|---|
| 27 |
} |
|---|
| 28 |
elseif($file->isFile()) |
|---|
| 29 |
{ |
|---|
| 30 |
$fname = ltrim(str_replace(dirname(__FILE__), '', $file->getPathname()),'/'); |
|---|
| 31 |
fwrite(STDOUT, $fname . "\n"); |
|---|
| 32 |
fwrite($log, '<file role="data" name="' . $fname . '" />' . "\n"); |
|---|
| 33 |
} |
|---|
| 34 |
} |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
fclose($log); |
|---|
| 38 |
|
|---|