If you are using python 2.x you can use:
commands.getoutput("ls –lR")
for python 3.0 you can try:
subprocess.check_output("ls -lR")
Hope this helps!
EDIT
Commands.getoutput and subprocess.check_output will return the result from the command that you used as a parameter.
Example:
lslr = commands.getoutput("ls –lR") print lslr
This will give you exactly the same result as ls -lR in the current directory. Then it is up to you to filter out everything you need from there!
To change the current directory, use os.chdir (/ wish / dir).
source share