Symfony Finder ignores files beginning by dot
Asked Answered
M

1

7

I am using the Finder for sending spooled e-mails, but automatic name generator puts dots in the filename and sometimes they appear at the beginning of the file.

It seems that the finder can't get files with that name - well those files are hidden... Has anyone experienced that behaviour? Any advice how to use the finder to locate hidden files?

Thx

Mewl answered 24/1, 2014 at 11:10 Comment(0)
C
18

Just set ignoreDotFiles to false.

$finder = new Finder();
$finder->files()->ignoreDotFiles(false)->in('directory');

For .git files, set ignoreVCS to false

$finder->files()
    ->ignoreVCS(false)
    ->ignoreDotFiles(false)->in('directory');
Cochlea answered 24/1, 2014 at 11:22 Comment(1)
Additionally. Even if ignoreDotFiles is set to false but you are using bash wildcard pattern of filename it won't work. So there you'd better use regular expression for name matching.Adequate

© 2022 - 2024 — McMap. All rights reserved.