0,0 → 1,46 |
#! /usr/bin/env jython |
import sys |
import os.path |
|
# ============================================================================= |
# Functions |
# ============================================================================= |
|
def Usage(mesg): |
print ("Usage: " + progname + " directory") |
print (mesg) |
|
def traverse(directory): |
curdir = os.getcwd() |
os.chdir(directory) |
curdir2 = os.getcwd() |
files = os.listdir(curdir2) |
for file in files: |
pfile = curdir2 + "/" + file |
if os.path.isdir(file) and not os.path.islink(file): |
print (pfile) |
traverse(file) |
else: |
if os.path.isfile(file) or os.path.islink(file): |
print (pfile) |
else: |
print ("WARNING: Could not process file " + pfile) |
os.chdir(curdir) |
|
def start_traverse(directory): |
print (directory) |
traverse(directory) |
|
# ============================================================================= |
# MAIN |
# ============================================================================= |
|
progname = os.path.basename(sys.argv[0]) |
if (len(sys.argv) == 2): |
directory = sys.argv[1] |
if os.path.isdir(directory): |
start_traverse(directory) |
else: |
Usage("ERROR: Not a directory : " + directory) |
else: |
Usage("ERROR: 1 argument expected") |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |