Changeset 990


Ignore:
Timestamp:
12/14/10 10:47:01 (13 years ago)
Author:
dietuyt
Message:

Changed the script, as our harvester no longer uses the directory
structure with the numbers. Now it directly processes all child directories
from where the script is started.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • metadata/trunk/toolkit/scripts/dir2cmdicollection.py

    r962 r990  
    3131       
    3232        if not simple_dir_structure:
    33                 for root, dirs, files in os.walk(os.getcwd()):
    34                         startpath = os.getcwd()         
    35                         for d in dirs:
    36                                 if d == "0":
    37                                         rootList.append(generate_branch(root, dirs))
     33                root = os.getcwd()             
     34                dirs = filter (os.path.isdir, os.listdir(root))         
     35                dirs.remove(target_dir.replace("/",""))
     36                #for root, dirs, files in os.walk(os.getcwd()):
     37                print dirs             
     38                for d in dirs:         
     39                        rootList.append(generate_branch(root, [d], d))
     40                        #startpath = os.getcwd()               
     41                        #for d in dirs:
     42                                #if d == "0":
     43                               
    3844        else:
    3945                rootList.append(generate_branch(os.getcwd(), [""], "lrt_inventory"))
    4046        writeCollection(rootList, "collection_root.cmdi", "olac-root")
    4147
    42 def generate_branch(root, dirs):
    43         collectionName = os.path.relpath(root)
    44         return generate_branch(root, dirs, collectionName)
     48#def generate_branch(root, dirs):
     49#       collectionName = os.path.relpath(root)
     50#       print collectionName
     51#       return generate_branch(root, dirs, collectionName)
    4552
    4653def generate_branch(root, dirs, collectionName):
     
    5259        for d in dirs:
    5360                fullpath = os.path.join(root, d)
     61                print fullpath
    5462                for file in os.listdir(fullpath):
    5563                        if ".cmdi" in file:
Note: See TracChangeset for help on using the changeset viewer.