Ya. Do it using python. Why do you want to use bash when you already have
python?

See, do something like this:-

import os
alldirs = os.listdir("/path/to/dir")

DIRS = [] #Only the dirs you are interested in

for i in alldirs:
      if i.find("deploy") is -1: L.append(i)
      if i.find("TEMPLATE") is -1: L.append(i)

#Now L contains all the required dirs.

Hope it helps.

On Tue, Oct 26, 2010 at 9:19 PM, Sean Carolan <scaro...@gmail.com> wrote:

> > Here is the bash one-liner that generates my list,
> > with one name per line:
> >
> > ls -d */ | grep -v -E 'deploy|TEMPLATE' | sed 's/\///'
> >
> > How would you get the output of this into a python list that could
> > then be used in the script?  Please forgive my ignorance; I've read
> > through the documentation but am still not clear on this aspect.
>
> Would this be easier to accomplish using os.listdir()?.  Basically I
> want to make a list of directories, excluding files and the
> directories or files containing "deploy" and "TEMPLATE".
>



-- 
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to