Skip to content
Vanessa Hamar edited this page Nov 12, 2013 · 6 revisions

6. File Catalog Interface

6.1 Starting the File Catalog Interface

  • DIRAC File Catalog Command Line Interface (CLI) can be used to perform all the data management operations. You can start the CLI with the command:

    dirac-dms-filecatalog-cli
    

    For example:

    $ dirac-dms-filecatalog-cli
    Starting DIRAC FileCatalog client
    File Catalog Client $Revision: 1.17 $Date:
    FC:/>help
    
    Documented commands (type help <topic>):
    ========================================
    add    chmod  find   guid  ls     pwd       replicate  rmreplica   user
    cd     chown  get    id    meta   register  rm         size
    chgrp  exit   group  lcd   mkdir  replicas  rmdir      unregister
    
    Undocumented commands:
    ======================
    help
    
    FC:/>
    

6.2 Basic File Catalog operations

  • Changing directory:

    $ dirac-dms-filecatalog-cli
    Starting FileCatalog client
    File Catalog Client $Revision: 1.17 $Date:
    FC:/> cd vo.france-asia.org/user/v/vhamar
    FC:/vo.france-asia.org/user/v/vhamar>
    
  • Listing directory::

    FC:/vo.france-asia.org/user/v/vhamar>ls -la -rwxrwxr-x 1 vhamar dirac_user 1170 2013-11-12 13:28:12 TestPekin-1.txt -rwxrwxr-x 1 vhamar dirac_user 1128 2013-11-12 13:34:27 TestPekin-2.txt

  • Creating new directory:

    FC:/vo.france-asia.org/user/v/vhamar>mkdir newDir2
    Successfully created directory: /vo.france-asia.org/user/v/vhamar/newDir2
    FC:/vo.france-asia.org/user/v/vhamar>ls -al newDir2
    FC:/vo.france-asia.org/user/v/vhamar>ls -la
    -rwxrwxr-x 1 vhamar dirac_user 1170 2013-11-12 13:28:12 TestPekin-1.txt
    -rwxrwxr-x 1 vhamar dirac_user 1128 2013-11-12 13:34:27 TestPekin-2.txt
    drwxr-xr-x 0 vhamar dirac_user    0 2013-11-06 16:35:55 newDir
    drwxrwxr-x 0 vhamar dirac_user    0 2013-11-12 14:02:51 newDir2
    
  • Changing ownership and permissions:

    FC:/vo.france-asia.org/user/v/vhamar>chmod 700 newDir2
    FC:/vo.france-asia.org/user/v/vhamar>ls -la
    -rwxrwxr-x 1 vhamar dirac_user 1170 2013-11-12 13:28:12 TestPekin-1.txt
    -rwxrwxr-x 1 vhamar dirac_user 1128 2013-11-12 13:34:27 TestPekin-2.txt
    drwxr-xr-x 0 vhamar dirac_user    0 2013-11-06 16:35:55 newDir
    drwx------ 0 vhamar dirac_user    0 2013-11-12 14:02:51 newDir2
    

6.3 Managing files and replicas

  • Upload a local file to the grid storage and register it in the catalog:

    add <LFN> <local_file> <SE>
    

    For example:

    FC:/> cd /vo.france-asia.org/user/v/vhamar/newDir2
    FC:/vo.france-asia.org/user/v/vhamar/newDir2>add Test-Pekin-3.txt Test-Pekin-3.txt DIRAC-USER
    File /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt successfully uploaded to the DIRAC-USER SE
    FC:/vo.france-asia.org/user/v/vhamar/newDir2>ls -la
    -rwxrwxr-x 1 vhamar dirac_user 1414 2013-11-12 14:07:13 Test-Pekin-3.txt
    
  • Download grid file to the local directory:

    get <LFN> [<local_directory>]
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar/newDir2>get Test-Pekin-3.txt /tmp
    File /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt successfully downloaded
    
  • Replicate a file registered and stored in a storage element to another storage element:

    replicate <lfn> <SE>
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar/newDir2>replicate Test-Pekin-3.txt CPPM-disk
    {'Failed': {},
    'Successful': {'/vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt':
       {'register': 1.2069821357727051,
        'replicate': 17.847687959671021}}}
    File /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt successfully replicated to the CPPM-disk SE
    
  • List replicas:

    replicas <LFN>
    

    For example:

    lfn: /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt
    DIRAC-USER      dips://dirac.ihep.ac.cn:9148/DataManagement/StorageElement/vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt
    CPPM-disk       srm://marsedpm.in2p3.fr:8446/srm/managerv2?SFN=/dpm/in2p3.fr/home/vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt
    
  • Remove replicas:

    rmreplica <LFN> <SE>
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar/newDir2>rmreplica Test-Pekin-3.txt CPPM-disk
    lfn: /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt
    Replica at CPPM-disk moved to Trash Bin
    
  • Remove file:

    rm <LFN>
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar/newDir2>rm Test-Pekin-3.txt
    lfn: /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt
    File /vo.france-asia.org/user/v/vhamar/newDir2/Test-Pekin-3.txt removed from the catalog
    FC:/vo.france-asia.org/user/v/vhamar/newDir2>ls
    FC:/vo.france-asia.org/user/v/vhamar/newDir2>
    
  • Remove directory:

    rmdir <path>
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar/newDir2>cd ..
    FC:/vo.france-asia.org/user/v/vhamar>rmdir newDir2
    lfn: /vo.france-asia.org/user/v/vhamar/newDir2
    

6.4 Getting extra information

  • Getting file or directory size:

    size <LFN>
    size <dir_path>
    

    For example:

    FC:/vo.france-asia.org/user/v/vhamar>size /vo.france-asia.org/user/v/vhamar/
    directory: /vo.france-asia.org/user/v/vhamar
    Logical Size: 4,474 Files: 7 Directories: 2
    Query time 0.00 sec
    
  • Your current identity:

    id
    

    For example:

    FC:/vo.france-asia.org/user/a/atsareg>id
    user=1(atsareg) group=2(dirac_user)
    
Clone this wiki locally