Ya. Do it using python. Why do you want to use bash when you already have python?<br><br>See, do something like this:- <br><br>import os<br>alldirs = os.listdir("/path/to/dir")<br><br>DIRS = [] #Only the dirs you are interested in<br>
<br>for i in alldirs:<br> if i.find("deploy") is -1: L.append(i)<br> if i.find("TEMPLATE") is -1: L.append(i)<br><br>#Now L contains all the required dirs.<br><br>Hope it helps.<br><br><div class="gmail_quote">
On Tue, Oct 26, 2010 at 9:19 PM, Sean Carolan <span dir="ltr"><<a href="mailto:scarolan@gmail.com">scarolan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">> Here is the bash one-liner that generates my list,<br>
> with one name per line:<br>
><br>
> ls -d */ | grep -v -E 'deploy|TEMPLATE' | sed 's/\///'<br>
><br>
> How would you get the output of this into a python list that could<br>
> then be used in the script? Please forgive my ignorance; I've read<br>
> through the documentation but am still not clear on this aspect.<br>
<br>
</div>Would this be easier to accomplish using os.listdir()?. Basically I<br>
want to make a list of directories, excluding files and the<br>
directories or files containing "deploy" and "TEMPLATE".<br>
</blockquote></div><br><br clear="all"><br>-- <br>Abhijeet Rastogi (shadyabhi)<br><a href="http://www.google.com/profiles/abhijeet.1989" target="_blank">http://www.google.com/profiles/abhijeet.1989</a><br>