parsed.org

Tips by tag: glob

File Globbing by cygnus on Jan 19, 2005 04:14 PM

Some examples of useful file globbing supported by Zsh (if setopt extendedglob has been run):

$ ls foo<1-100>
  (Lists files 'foo1', 'foo2', ..., 'foo100')
$ ls foo<-50>
  (Lists files up to 'foo50')
$ ls *.c~foo.c
  (Lists all *.c files except foo.c)
$ ls *.php~foo*(.)
  (Lists all plain *.php files except those starting with 'foo')
extrasglobzsh
Globbing by xinu on Feb 08, 2005 12:27 PM

An often-used concept in shell scripting is globbing. You can use this in python, as well:

import glob

for textFile in glob.glob("*.txt"):
    # Do something with 'textFile'.
globimportlanguagesmodulesprogrammingpythonshell
RSS