I have a folder full of files and I want to search some string inside them. The issue is that some files may be zip, exe, ogg, etc.
Can I check somehow what kind of file is it so I only open and search through txt, PHP, etc. files.
I can't rely on the file extension.
If you're on linux you can parse the output of the file command-line tool.
How to check if a file contains plain text?