views:

24

answers:

2

I have a list of file names(I already have the filelist let's say in a text file). I want to process this list in the following way:

  • filenames of type /dirX/subdirX//.ext will be written in a new file
  • all the other filenames will be written in a separate file.

Is there any option to verify if a filename corresponds to a mask, without reading the file name from disk?(by filename I mean a simple string). I would like to know if there is such a function that don't require disk access. I know regex could be an workaround but I'd like to have something from php.

+3  A: 

Maybe you need fnmatch() ?

You should post some sample data if you need further info.

kemp
exactly what i was looking for, thanks
php html
+1  A: 

You could likely use fnmatch which is built for the task you are asking to solve. If that is not quite suitable, perhaps regular expressions could be of use.

Clarifying what your mask consists of would likely help guide answers towards what you want.

salathe
I've accepted kemp answer. fnmatch is what i was looking for. thanks.
php html