realWasabi Posted December 1, 2013 Share Posted December 1, 2013 Hi I'm trying to write a script that searches through files in a folder and return the filenames matching the search criterias. It needs only read the filenames, and not the file contents (.pdf files). All the files are formatted like this: street name,housenumber,cust name,casetype,casenumber,archivedate.pdf (notice that the streetname+custname may contain spaces.) I need to be able to search freely on one or more criterias - while also using * as a wildcard (fx. searching for street* instead of full streatname) So far I have been using if statements to return search results, but as more and more files are being added (700+ at the moment), along with the large number of criterias, this does not seem like the most efficient way to do this - nor does it seem like the "correct" way. What would be the best way to go about this? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted December 1, 2013 Share Posted December 1, 2013 the best way would be to read, parse, and store the information in a database. you can then let the database engine do the work of finding information. all you need to do is form and run the database query statements. Quote Link to comment Share on other sites More sharing options...
jcbones Posted December 1, 2013 Share Posted December 1, 2013 If you HAVE to use the files, you could try glob(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.