Quantcast
Channel: Recursion – Geekality
Browsing all 4 articles
Browse latest View live

PHP: Simple directory recursion

Keep running into scenarios where I need to scan through a file system and it’s actually pretty simple if you just know what classes to use. So… note to self and others: // This should return false if...

View Article



PowerShell: Search for and delete files recursively

Short and simple, but keep forgetting some minor details, so… note to self… # Files gci -recurse -force | where {$_.name -eq "Thumbs.db"} | foreach {ri $_.fullname -whatif} # Directories (and using...

View Article

PHP: Delete directory recursively

function delete_directory($dir) {     if( ! file_exists($dir))         return;     $it = new RecursiveDirectoryIterator($dir);     $it = new RecursiveIteratorIterator($it,...

View Article

PHP: Pathable RecursiveIteratorIterator

Needed to recursively loop through a multi-dimensional array and print out each leaf-node with its full “path”. For this I used an RecursiveArrayIterator for the array and a RecursiveIteratorIterator...

View Article
Browsing all 4 articles
Browse latest View live


Latest Images