gr68
gr68

Reputation: 502

how to search files using php (need alternative way for linux find)

I need to execute following linux find command

find /home/*/mail/ -type d -name ".test" > tmp_file

but using php (since the find command for some reason freeze in some OS) . How to do this search using php and put results in tmp_file?

Thank you

Upvotes: 0

Views: 192

Answers (2)

Frank
Frank

Reputation: 106

You can use glob function.

Check it out http://php.net/manual/en/function.glob.php

Upvotes: 1

E_p
E_p

Reputation: 3144

You can always use FilesystemIterator, DirectoryIterator

https://www.php.net/manual/en/class.filesystemiterator.php

https://www.php.net/manual/en/class.directoryiterator.php

Upvotes: 1

Related Questions