# File :    dirac-dms-get-file
# Author :  Stuart Paterson
########################################################################
"""
  Retrieve a single file or list of files from Grid storage to the current directory.
"""
__RCSID__ = "$Id$"
import os

from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerNamespaceSwitches('download to (default = %s)' %
                                       os.path.realpath('.'))

    Script.setUsageMessage('\n'.join([
        __doc__,
        'Usage:',
        '  %s [option|cfgfile] [<LFN>] [<LFN>...] [SourceSE]' %
        Script.scriptName,
    ]))

    Script.parseCommandLine(ignoreErrors=False)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeGetFile
    from DIRAC import exit
    exit(executeGetFile(dmScript))
Exemple #2
0
# Code

if __name__ == '__main__':

    # Script initialization
    from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script
    import DIRAC

    Script.setUsageMessage('\n'.join([
        __doc__,
        'Usage:',
        '  %s [option|cfgfile] [values]' % Script.scriptName,
    ]))
    dmScript = DMScript()
    dmScript.registerNamespaceSwitches()  # Directory
    dmScript.registerFileSwitches()  # File, LFNs
    dmScript.registerBKSwitches()
    Script.registerSwitch('', 'FixBK', '   Take action to fix the BK')
    Script.registerSwitch('', 'FixFC', '   Take action to fix the FC')
    Script.registerSwitch(
        '', 'AffectedRuns',
        '   List the runs affected by the encountered problem')
    Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import gLogger
    fixBK = False
    fixFC = False
    listAffectedRuns = False
    for switch in Script.getUnprocessedSwitches():
        if switch[0] == 'FixFC':
"""
Get the list of all the user files.
"""
__RCSID__ = "$Id$"

from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

if __name__ == "__main__":

    days = 0
    months = 0
    years = 0
    depth = 1
    wildcard = '*'
    dmScript = DMScript()
    dmScript.registerNamespaceSwitches()
    Script.registerSwitch("", "Days=",
                          "Match files older than number of days [%s]" % days)
    Script.registerSwitch(
        "", "Months=", "Match files older than number of months [%s]" % months)
    Script.registerSwitch(
        "", "Years=", "Match files older than number of years [%s]" % years)
    Script.registerSwitch("", "Wildcard=",
                          "Wildcard for matching filenames [%s]" % wildcard)
    Script.registerSwitch('', 'Output', 'Write list to an output file')
    Script.registerSwitch("", "EmptyDirs",
                          "Create a list of empty directories")
    Script.registerSwitch(
        "", "Depth=",
        "Depth to which recursively browse (default = %d)" % depth)
    Script.registerSwitch("r", "Recursive", "Set depth to infinite")