glob

Is it possible to craft a glob that matches files in the current directory and all subdirectoies?

For this directory structure: . |-- README.txt |-- firstlevel.rb `-- lib |-- models | |-- foo | | `-- fourthlevel.rb | `-- thirdlevel.rb `-- secondlevel.rb 3 directories, 5 files The glob would match: firstlevel.rb lib/secondlevel.rb lib/models/thirdlevel.rb lib/models/foo/fourthlevel.rb ...

Case-insensitive Glob on zsh/bash

I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome. ...

glob pattern matching in .NET

Is there a built-in mechanism in .NET to match patterns other than Regular Expressions? I'd like to match using UNIX style (glob) wildcards (* = any number of any character). I'd like to use this for a end-user facing control. I fear that permitting all RegEx capabilities will be very confusing. ...

How can I use negative wildcards in a unix/linux shell?

Say I want to copy the contents of a directory excluding files and folders whose names contain the word 'Music'. cp [exclude-matches] *Music* /target_directory What should go in place of [exclude-matches] to accomplish this? ...

How to glob variables in bash script?

When the following two lines of code are executed in a bash script, "ls" complains that the files don't exist: dirs=/content/{dev01,dev02} ls -l $dirs When I run the script with the -x option, it appears to be passing the variable within single quotes (which would prevent globbing): + dirs=/content/{dev01,dev01} + ls -l '/content/{de...

Text specification for a tree of files?

I'm looking for examples of specifying files in a tree structure, for example, for specifying the set of files to search in a grep tool. I'd like to be able to include and exclude files and directories by name matches. I'm sure there are examples out there, but I'm having a hard time finding them. Here's an example of a possible synt...

How to implement glob in C#

I don't know if it's legit at StackOverflow to post your own answer to a question, but I saw nobody had asked this already. I went looking for a C# Glob and didn't find one, so I wrote one that others might find useful. ...

Create regex from glob expression

Hi, i write program that parse text with regular expression. Regular expression should be obtained from user. I deside to use glob syntax for user input, and convert glob string to the regular expression internally. For example: "foo.? bar*" should be converted to "^.*foo\.\w\bar\w+.*" Somehow, i need to escape all meaningful cha...

Regular expression (glob) search tree

Anyone know how one might adapt a search tree to handle limited regular expressions? The task is, given a file name, find all nodes matching that file name. Nodes may contain usual file name globs (* and ?). Obviously, since this is a search tree, speed is of the essence. EDIT: I should add that the most important case for speed is the ...

Move all files except one

How can I move all files except one? I am looking for something like: 'mv ~/Linux/Old/!Tux.png ~/Linux/New/' where I move old stuff to new stuff -folder except a Tux.png. !-sign represents a negation. Is there some tool for the job? ...

Unable to understand a line in SED

I run the following code sed 's/\([^ ]+\) your \([^ ]+\)/ \2\1er/' < fail The file fail is fail your test The above command gives me fail your test although it should give "testfailer". The second and first globs \2\1 should be at the start of the word "er". This suggests me that the problem may be in the regexes in the searc...

Can I use a Perl constant in the glob operator?

I'm parsing XML files with something like: while (<files/*.xml>) { ... } I want to use a constant to 'files', say use constant FILES_PATH => 'files'; while (<FILES_PATH/*.xml>) { ... } I hope you understand the idea, and can help me :).. Thank you in advance. ...

looking for open source .Net wiki/blog

Hello everyone, I am looking for easy to use/maintain open source .Net based wiki/blog. I do not have Active Directory setup, so appreciated if it is open source with SQL Server based user management wiki/blog. I need the project written in .Net (C#). Any recommendations? thanks in advance, George ...

Perl glob and filehandle problems

Ok, I have a bit of an issue here. I realize that I don't need to set a $handle to *::HTML to get this snippet to work, however this code is taken out of context from its use and I do in fact need this to work with the $handle. The output I am receiving is below the snippet however the output I want is for the file.html to contain "what\...

Looking for elegant glob-like DNA string expansion

Hello, I'm trying to make a glob-like expansion of a set of DNA strings that have multiple possible bases. The base of my DNA strings contains the letters A, C, G, and T. However, I can have special characters like M which could be an A or a C. For example, say I have the string: ATMM I would like to take this string as input and o...

How does this Perl one liner to check if a directory is empty work?

I got this strange line of code today, it tells me 'empty' or 'not empty' depending on whether the CWD has any items (other than . and ..) in it. I want to know how it works because it makes no sense to me. perl -le 'print+(q=not =)[2==(()=<.* *>)].empty' The bit I am interested in is <.* *>. I don't understand how it gets the names ...

osx change file encoding (iconv) recursive

hi, I know I can convert a single file encoding under OSX using: iconv -f ISO-8859-1 -t UTF-8 myfilename.xxx > myfilename-utf8.xxx I have to convert a bunch of files with a specific extension, so I want to convert file encoding from ISO-8859-1 to UTF-8 for all *.ext files in folder /mydisk/myfolder perhaps someobe know the syntax how ...

php glob() and brackets: []

Hey there lovely stackoverflow people! I have got directories which contain brackets in the names. i.e. "dir_123[[email protected]]" Within that dirs there are .tif files. What I do is counting the Tif files. On my Mac I did that with MAMP and it worked great: $anz = count(glob(str_replace("[", "\[", "dir_123[[email protected]]/*.tif"))); On...

Win32 API to do wildcard string match

Hello, I am looking for a wildcard string match API (not regex match). I cannot use anything other than Win32 APIs. ...

How exactly does zsh expand globs?

I have a C program that displays it's command-line by iterating through the argv variable. #include <stdio.h> int main(int argc, char *argv[]){ int i = 0; printf("----------\n"); for(i = 0; i < argc; i++) printf("%s\n", argv[i]); return 0; } I invoked the program in a folder containing a large C++ source tree lik...