NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 143

Show
Ignore:
Timestamp:
03/27/08 19:52:45
Author:
cbc
Message:

Add --force-update option.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodar/trunk/sodar/utils/findMissing.py

    r140 r143  
    77import os 
    88 
    9 def findMissing(source, destination): 
     9def findMissing(source, destination, force): 
    1010    """ 
    1111    Find raw sodar data files in need of processing. 
     
    2424    sourceWalk = sourceWalk[1:] 
    2525     
    26     destinationWalk = os.walk(destination) 
    27     destinationWalk = [(fullPath, subDirs, files) 
    28                        for fullPath, subDirs, files 
    29                        in destinationWalk] 
    30     destinationWalk = destinationWalk[1:] 
    31     destinationWalk = [fullPath 
    32                        for fullPath, subDirs, files 
    33                        in destinationWalk 
    34                        if not subDirs] 
    35     # always mark most recent destination as missing 
    36     # to keep it updated as source is updated during the day 
    37     destinationWalk = sorted(destinationWalk) 
    38     destinationWalk = destinationWalk[:-1] 
     26    if force: 
     27        destinationWalk = [] 
     28    else: 
     29        destinationWalk = os.walk(destination) 
     30        destinationWalk = [(fullPath, subDirs, files) 
     31                           for fullPath, subDirs, files 
     32                           in destinationWalk] 
     33        destinationWalk = destinationWalk[1:] 
     34        destinationWalk = [fullPath 
     35                           for fullPath, subDirs, files 
     36                           in destinationWalk 
     37                           if not subDirs] 
     38        # always mark most recent destination as missing 
     39        # to keep it updated as source is updated during the day 
     40        destinationWalk = sorted(destinationWalk) 
     41        destinationWalk = destinationWalk[:-1] 
    3942     
    4043    idealWalk = [os.path.join(destination,