You are here: Re: [PHP] searching for files in a directory with a specific structure. « PHP « IT news, forums, messages
Re: [PHP] searching for files in a directory with a specific structure.

Posted by Stut on 07/11/05 18:44

babu wrote:
> I have a directory which has thousands of files based on date.
> for example
> yyyymmdd-number(auto increment).txt
> 20050101-0001.txt,20050101-0002.txt............................20050101-0210.txt
> 20050102-0001.txt,20050102-0002.txt..............................20050102-0141.txt
>
> and many other files, but i want to extract data from the files with the above format.
>
> I have seen in the php documentation for reading a directory,but not files with a specific structure.i could not able to write the correct regular expression for the filename match.
> can some one give an idea.

Check out http://php.net/glob. This might not be the best way to do it
if you have *lots* of files since it returns all matches in an array.

A regex to match might look something like \d\d\d\d\d\d\-\d\d\d\d\.txt
but I'm no regex expert.

-Stut

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация