Reputation:
Hello i have folder with some files inside and i want to create script inside in that folder.
Upvotes: 0
Views: 49
Reputation: 16035
You could use SPL for that:
$filesystem_iterator = new FilesystemIterator(".", FilesystemIterator::SKIP_DOTS + FilesystemIterator::CURRENT_AS_PATHNAME);
$filesystem_iterator = new RegexIterator($filesystem_iterator, "~backup_\\d{4}_\\d{2}_\\d{2}.zip~");
foreach ($filesystem_iterator as $pathname)
{
var_dump ($pathname);
...
}
Upvotes: 1
Reputation: 91
PHP has a function named glob()
which let's you find directories and files with a pattern: http://php.net/manual/en/function.glob.php
Upvotes: 1