Created
February 3, 2012 11:29
-
-
Save brodul/1729758 to your computer and use it in GitHub Desktop.
List files with fabric
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import env, run, cd | |
env.hosts = ["localhost"] | |
def list_dir(dir=None): | |
"""docstring for list_dir""" | |
dir = dir or env.cwd | |
string = run("for i in %s*; do echo $i; done" % dir) | |
files = string.replace("\r","").split("\n") | |
return files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Makes it a little less verbose: