codice:$filesTutti = glob('path/*.*'); $filesDaNonCancellare = glob('path/*.{ext1,ext2,ext3}', GLOB_BRACE); $filesDaCancellare = array_diff($filesDaNonCancellare, $filesTutti); foreach ($filesDaCancellare as $filename) { unlink($filename); }
codice:$filesTutti = glob('path/*.*'); $filesDaNonCancellare = glob('path/*.{ext1,ext2,ext3}', GLOB_BRACE); $filesDaCancellare = array_diff($filesDaNonCancellare, $filesTutti); foreach ($filesDaCancellare as $filename) { unlink($filename); }
The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand