Skip to content

Instantly share code, notes, and snippets.

@miura
Created February 10, 2014 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miura/8915151 to your computer and use it in GitHub Desktop.
Save miura/8915151 to your computer and use it in GitHub Desktop.
import os, re
def filterdirs(folderpath):
dirs = os.listdir(folderpath)
pattern = re.compile('(.*)-(.*)--(.*)')
dirlist = []
for d in dirs:
if d.startswith('0'):
res = re.search(pattern, d)
#if int(res.group(1)) > 9 and int(res.group(1)) < 160:
if int(res.group(1)) < 160:
dirlist.append(d)
return sorted(dirlist)
folderpath = '/g/data/bio-it_centres_course/data/VSVG'
plates = filterdirs(folderpath)
print "plate number", len(plates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment