Skip to content

Instantly share code, notes, and snippets.

@YuriyNasretdinov
Created April 11, 2016 15:51
Show Gist options
  • Select an option

  • Save YuriyNasretdinov/2f6d12dae627b0b27cee4c8af7f97def to your computer and use it in GitHub Desktop.

Select an option

Save YuriyNasretdinov/2f6d12dae627b0b27cee4c8af7f97def to your computer and use it in GitHub Desktop.

Revisions

  1. YuriyNasretdinov created this gist Apr 11, 2016.
    21 changes: 21 additions & 0 deletions find-ob.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?php
    function doFind($dir) {
    $dh = opendir($dir);
    if (!$dh) die("Could not open $dir\n");

    while (false !== ($f = readdir($dh))) {
    if ($f === '.' || $f === '..') continue;
    $path = $dir . '/' . $f;
    echo $path . "\n";

    if (is_dir($path) && !is_link($path)) {
    doFind($path);
    }
    }

    closedir($dh);
    }

    ob_start();
    doFind($argv[1]);
    ob_end_flush();