Yeo, sup?

Removing a bunch of files with php

A handy script for removing a lot of hidden png images from a directory, with thanks to our good friend Alan Foster.

<?php
ini_set('memory_limit', '64M'); // There was a lot of pictures (cunt)
          foreach(glob('{,.}*.png', GLOB_BRACE) as $file){
          unlink($file);
};
echo "Removed";
?>

 

{,.} Is used to include the "." which hides a file in the linux filesystem and is not normally found with glob. "*" is used as a wildcard and ".png" is what  I wanted to search for to remove.

<< Go back to the previous page