glob

what is the better way to search in millions of file names with wildcard(GLOB) support

i am working on a small search engine to display a matching file names with full path. and important thing is that i need to provide wildcard(GLOB) search like *.doc or *list*.xlx or *timesheet* or ???.doc or something like that. i found some related solution http://stackoverflow.com/questions/954752/search-for-strings-matching-the-p...

git: How do I recursively add all files in a directory subtree that match a glob pattern?

I have several .screen files inside /xxx/documentation and its subdirectories that are already tracked by Git. After modifying many of these screen files, I run git add documentation/\\*.screen—as indicated by the first example in git-add's documentation—to stage these files, but the command fails: fatal: pathspec 'documentation/\*.scr...

PHP 5.3.1 glob:// exception

Hi all, I'm having problems with the glob:// stream wrapper included in the PHP 5.3.0 version. I'm using the following PHP version: PHP 5.3.1-0.dotdeb.1 with Suhosin-Patch (cli) (built: Dec 5 2009 20:08:29) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies When I try to...

About Mercurial, .hgignore file and glob syntax

Is it possible, while using glob syntax for an .hgignore file, to recursively ignore certain files and folders, except one? Assuming that you have: a/ a/b a/c a/d Something like: syntax globe: a ^a/b This should ideally ignore c and d and keep b. I know this has been discussed in other SO questions, but it seems they're all using...

How to prevent wild card glob expansion for occurring for my command like scp does?

I wish for my application to accept an file specification argument literally, without wildcard expansion. This is because the directory from which my command is being run is not the directory (or machine) where the glob expansion should be performed. I believe the scp somehow manages to do this, but I am at a loss to replicate that in ...

How to make mercurial ignore all hidden files?

I hate seeing nearly every directory in my repository list each file twice, once with a dot in front of it and once without. I tried adding .* to my .hgignore file, but it has no effect. Is this the wrong syntax, and more importantly, is it a bad idea to try this in the first place? Thanks. ...

How to overwrite an array of char pointers with a larger list of char pointers?

My function is being passed a struct containing, among other things, a NULL terminated array of pointers to words making up a command with arguments. I'm performing a glob match on the list of arguments, to expand them into a full list of files, then I want to replace the passed argument array with the new expanded one. The globbing is...

Can PHP's glob() be made to find files in a case insensitive manner?

I want all CSV files in a directory, so I use glob('my/dir/*.CSV') This however doesn't find files with a lowercase CSV extension. I could use glob('my/dir/*.{CSV,csv}', GLOB_BRACE); But is there a way to allow all mixed case versions? Or is this just a limitation of glob() ? ...

GLOB_BRACE portability?

In this question, I was made aware of glob()'s GLOB_BRACE option that allows for a limited set of regular expressions when searching for files. This looks just like what I need, but according to the manual, GLOB_BRACE is "not available on some Non-GNU Operating systems." Among those seems to be Solaris. I am building an application th...

bash: getting rid of '.' and '..' when looping over files that begin with '.' in a folder

I want to loop over the files that begin with '.' in directory x (x might be any path): $ for file in x/.* > do > echo -n $file" " > done x/. x/.. x/..a x/.b What is the best way to get rid of x/., and x/.. ? ...

Is the mercurial default glob matching syntax configurable?

To run a command on a single file, I recently realized I can do this: hg log relglob:UniqueFilename instead of: hg log some/really/deep/directory/hierarchy/UniqueFilename I'd like to take this one step further and make relglob the default matching syntax. Is this possible? ...

python glob and bracket characters ('[]')

/Users/smcho/Desktop/bracket/[10,20] directory has "abc.txt", but when I run this python code import glob import os.path path1 = "/Users/smcho/Desktop/bracket/\[10,20\]" pathName = os.path.join(path1, "*.txt") print glob.glob(pathName) It returns empty list. Can't python's glob doesn't handle the bracket letters or others? Is the...

Count the number of files in a directory using python

I need to count the number of files in a directory using Python. I guess the easiest way is len(glob.glob('*')), but I also count the directory as file. Is there any way to count only the files in a directory? ...

Why doesn't Perl file glob() work outside of a loop in scalar context?

According to the Perl documentation on file globbing, the <*> operator or glob() function, when used in a scalar context, should iterate through the list of files matching the specified pattern, returning the next file name each time it is called or undef when there are no more files. But, the iterating process only seems to work from ...

Glob function (c) and backup file (file~)

I'm using glob function for a autocompletion function. I'm showing you the problem because it's difficult to explain: matched = ~/.tcsh glob(matched, 0, NULL, &pglob); glob put all matched files in a char ** and when I print it I have: case[0] = .tcshrc case[1] = I should have .tcshrc~ in case[1], but nothing =S, I've seen a flag ...

use python glob to find a folder that is a 14 digit number

I have a folder with subfolders that are all in the pattern YYYYMMDDHHMMSS (timestamp). I want to use glob to only select the folders that match that pattern. ...

Problem of * in Command line argument

I wrote a program in Java that accepts input via command line arguments. I get input of two numbers and an operator from the command line. To multiply two numbers, i have to give input as e.g. 5 3 *, but it's not working as written. Why is it not accepting * from the command line? ...

Which is faster: glob() or opendir()

Which is faster between glob() and opendir(), for reading around 1-2K file(s)? ...

How can I download all files of a specific type from a website using PHP?

I want to get all midi (*.mid) files from a site that's set up pretty simple in terms of directory tree structure. I wish we had wget installed here, but that's another party.... The site is VGMusic.com and the path containing all of the midi files is: http://www.vgmusic.com/music/console/nintendo/nes/ I tried glob'ing it out, but I...

File Glob in C++

What's the C++ way of Perl's idiom: my @files = glob("file*.txt"); foreach my $file (@files) { # process $file } ...