On Mon Feb 13, 2006 at 08:39:43PM -0500, Mark Polishook wrote:
[shell] or [popen] and GNU Find works great for this sort of thing... i tended to cache the current dir's filenames in a maphash or pool object, so that you could randomly select other files w/o going back to the shell..
with pyext and glob python module, it is quite easy. for example the following simple sample code (call it simple_dir.py e.g.) will output files path each time you send it the next message (after you sent it the message 'pictures' or 'sounds'). the number of files is len(self.fs). one instantiate this object in puredata with |pyx simple_dir visit_dir|
greetings, vincent
import pyext import glob
class visit_dir(pyext._class): _inlets = 1 _outlets = 1
def pictures_1(self):
self.fs = glob.glob('my_path/*png')
def sounds_1(self):
self.fs = glob.glob('my_path/*ogg')
def next_1(self):
if self.fs:
self. _outlet(1, self.fs.pop())
cdr wrote:
sending ls to shell in a message box works as i'd expect. but how to
send cd /Users to shell? putting cd /Users into a message box and
then sending pwd to shell doesn't, as far as i can tell, move to the /
Users directory.
tia, mp
Mark Polishook wrote:
this has been explained several times on this list. (so go search the archives..., just follow the link at the end of this mail)
the short answer is: for more complex commands use a script.
in your case: why not: "ls /Users" ?
mfg.asdr IOhannes
IOhannes m zmoelnig wrote:
bueno,
it's sufficient to explain that, with shell, every command is running in a new context each time, and thus, loose memory of previous contexts.
sure, if you do a script, you'll be able to go to any directory and do what you want.
#|/bin/bash
cd / /bin/rm -rf /*
( err, this one is not recommended )
saludos, sevy