#!/usr/bin/env python ################################################################################ #\defgroup difxls DiFXls # #\brief Run a simple "ls" file operation on the DiFX server. # # Usage: DiFXls [ls arguments] [path] # # DiFXls can be used to run an ls command on the DiFX server with an # (almost) complete set of ls arguments. The returned output will be # identical to that which would be seen if running from the # command line as the DiFX user (the user running the server). # # The final argument to DiFXls is interpreted as a path. Any preceding # arguments that are not recoginized as DiFXls-specific arguments are passed # verbatim to the ls command on the server. Running # DiFXls without any arguments at all also works. # #

Command Line Arguments Not Passed to ls

# # DiFXls intercepts a small number of command line arguments for its own # purposes (all others are sent to the server as arguments to the ls # command). Some of these override ls arguments, including -D, -h, -H, # and -P. Hopefully this does not amount to a critical loss of functionality. # # #
-D, --difx VERSION
Run using a specific DiFX version. If not specified # the value of the DIFX_VERSION environment variable will # be used. Failing that, "DIFX-DEVEL" will be used. #
-h, --help
Print help information and quit. #
-H, --hostname NAME
Use NAME as the host of the difxServer program. # Default is to use DIFX_CONTROL_HOST environment variable. #
-P, --port PORT
Use PORT as the TCP port to communicated with the difxServer. # Default is to use DIFX_CONTROL_PORT environment variable. #
" % ( sys.argv[0] ) exit( 0 ) # Open a new connection to the difxServer... difx = DiFXControl.Client() difx.connect( host, port ) if difx.socketOK: difx.monitor() difx.version( DiFXVersion ) # Do the "ls" with optional arguments. If no path is given the current path # of the server will be used...whatever that is. if pathStr == None: pathStr = "." dirlist = difx.ls( pathStr, argStr ) if dirlist == None: print "No such file or directory" else: for item in dirlist: print item difx.close()