Created
March 4, 2016 14:04
-
-
Save stampycode/a88894d72de540ff5932 to your computer and use it in GitHub Desktop.
check which files/dirs are writeable, recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$out = []; | |
function readall($dir, &$out) { | |
$try = explode("\n", `ls -1 $dir/`); | |
$try = array_flip($try); | |
foreach($try as $k => $v) { | |
if(!$k || $k === '.' || $k === '..') { | |
continue; | |
} | |
$k = "$dir/$k"; | |
if(is_dir($k)) { | |
readall($k, $out); | |
continue; | |
} | |
$fh = fopen($k, 'a'); | |
$out[$k] = ($fh) ? '1' : '0'; | |
} | |
}; | |
readall('../app', $out); | |
print_r($out); | |
die; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment