Sep 24, 2009, 2:41 PM
Post #1 of 4
I have the following very simple code.
glob and regex
@files = glob("C:\\test\\*");
$file_count = @files;
As you can see, I am globbing everything in the directory C:\test and printing the count of the files. How do I utilize regex to modify the parameter of the glob so that...
(1) I exclude any files that containt the underscore character ( "_" )
(2) But include certain specific files that have the underscore character.
For example, if the file list in the directory was
Then I want to print 3. (Eventhough the last file has the underscore character, I want to include this in the glob.)
I would guess, somewhere in the regex I would need to hard code the files I want, in this case, the file called include_this_file.txt.
(This post was edited by DoolinDalton on Sep 24, 2009, 2:43 PM)