Пример #1
0
    def dir_list(self, dir_obj, pattern):
        
        complete_path = dir_obj._url.path
        result = []

        try:
            self.log_info("Trying to LSDIR '%s'" % (complete_path))

            dir = lfc.lfc_opendir(complete_path)
            if dir == None:
                raise Exception('Could not open dir')

            while True:
                entry = lfc.lfc_readdirxr(dir)
                if entry == None:
                    break
                result.append(entry.d_name)

            lfc.lfc_closedir(dir)

        except Exception, ex:
            self.log_error_and_raise(bliss.saga.Error.NoSuccess,
            "Couldn't list directory: %s " % (str(ex)))
Пример #2
0
 def cd(path, version=2):
     if version == 1:
         raise NotImplementedError("Support for lfc1 was removed!")
     else:
         return lfc.lfc_opendir(path)
Пример #3
0
"""

import sys,stat
import traceback
import os

sys.path.append( os.environ["LCG_LOCATION"] )
import lfc2 as lfc

if len(sys.argv) < 2:
        print "Syntax: %s <LFC_directory>" % sys.argv[0]
        sys.exit(-1)

name = sys.argv[1]

dir = lfc.lfc_opendir(name)
if (dir == None) or (dir == 0):
        print  "Error  while  looking  for  " + name + ": No such a file or directory"
        sys.exit(1)

try:
        while 1:
                entry = lfc.lfc_readdirxr(dir)
                if entry == None:
                        break
                print entry.d_name
                if stat.S_ISDIR(entry.filemode):
                        print " ==> Directory"
                else:
                        print "GUID : %s" % entry.guid
                        for i in range(entry.nbreplicas):