Doh! Didn't cc the list on my reply. -John
---------- Forwarded message ---------- From: John Keyes <johnke...@gmail.com> Date: Fri, Sep 24, 2010 at 11:41 PM Subject: Re: [Fab-user] How do I search for files remotely using glob.glob? To: Yungwei Chen <yung...@resolvity.com> > I am trying to find a file on the remote machine using glob.glob, but it > doesn't do that on the remote machine. > Do I need to install python 2.6 on the remote machine? > What am I missing here? Thanks. Fabric doesn't run on the remote machine, it invokes commands on the remote machine. If you want to use glob to find the files, you need to have a python script on the remote machine that contains your glob code e.g. #!/bin/python # /home/yungwei/last_modified.py last_mod_file = "" for file in glob.glob("/var/lib/mysql-backup/*"): if (file > last_mod_file): last_mod_file = file print last_mod_file,"is the last modified." Then run that script (provided you already have Python installed on the remote machine) via fabric.operations.run or fabric.operations.sudo. For example: from fabric.operations import run env.hosts = ['us...@12.16.222.222'] def print_latest_model(): run('~/last_modified.py') (NB: I haven't tested this code, just pointing you in the right direction) The docs at http://docs.fabfile.org/0.9.2/index.html contain this information, you should familiarize yourself with them to learn more about Fabric. Cheers, -John _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user