PHP – Delete files by pattern

Martin Zeller php 1 Comment

If you want to delete files by pattern (e.g. “*.txt”) in a directory, you can do this with the php function glob!

$files = glob('/path/to/files/*.txt'); // finds all txt files in the directory /path/to/files/
foreach($files as $file)

With this method you can also delete all files of a directory – with pattern *.*

PDF: direct printing with .NET

Martin Zeller .net 47 Comments