Discussion:
wildcard in php
(too old to reply)
Onno Dreischor
2014-01-14 14:39:32 UTC
Permalink
I would like to find in a directory files that have a specified
character in common. In DOS that would go with P*.jpg etc. Is there an
equivalent in php?
(I know about opendir, readdir and closedir)
Thank you,
Onno
Jerry Stuckle
2014-01-14 15:12:30 UTC
Permalink
Post by Onno Dreischor
I would like to find in a directory files that have a specified
character in common. In DOS that would go with P*.jpg etc. Is there an
equivalent in php?
(I know about opendir, readdir and closedir)
Thank you,
Onno
http://www.lmgtfy.com/?q=+php+file+search+wildcard
--
==================
Remove the "x" from my email address
Jerry Stuckle
***@attglobal.net
==================
Onno Dreischor
2014-01-14 15:35:57 UTC
Permalink
Post by Jerry Stuckle
Post by Onno Dreischor
I would like to find in a directory files that have a specified
character in common. In DOS that would go with P*.jpg etc. Is there an
equivalent in php?
(I know about opendir, readdir and closedir)
Thank you,
Onno
http://www.lmgtfy.com/?q=+php+file+search+wildcard
Thank you. Of course I have been searching. The problem always is asking
the right question. Thank you again.
Onno
r***@gmail.com
2019-12-19 12:46:47 UTC
Permalink
Post by Onno Dreischor
I would like to find in a directory files that have a specified
character in common. In DOS that would go with P*.jpg etc. Is there an
equivalent in php?
(I know about opendir, readdir and closedir)
Thank you,
Onno
As far as I remember it should be just "."


Kristjan Robam
Max Mustermann
2019-12-27 16:14:36 UTC
Permalink
Post by r***@gmail.com
Post by Onno Dreischor
I would like to find in a directory files that have a specified
character in common. In DOS that would go with P*.jpg etc. Is there an
equivalent in php?
(I know about opendir, readdir and closedir)
Thank you,
Onno
As far as I remember it should be just "."
Kristjan Robam
another way is using glob as replacement for opendir


<?php
foreach (glob("*.txt") as $filename) {
echo "$filename - Größe: " . filesize($filename) . "\n";
}
?>

Loading...