-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrm_List.py
39 lines (28 loc) · 1017 Bytes
/
srm_List.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/env python
from sys import exit, argv
import subprocess
import optparse
def main():
usage = 'usage: %prog [options]'
parser = optparse.OptionParser(usage)
parser.add_option('--site', '-s', dest='site', help='Site where files are located. Can be [t3psi,t2cscs]')
(opt, args) = parser.parse_args()
if not opt.site:
parser.error('No site selected')
if len(args)!=1:
parser.error('Wrong number of arguments')
dir = args[0]
if opt.site == 't3psi':
srmpath = "srm://t3se01.psi.ch:8443/srm/managerv2?SFN="
rootpath = srmpath+'/pnfs/psi.ch/cms/trivcat/'
elif opt.site == 't2cscs':
srmpath = "srm://storage01.lcg.cscs.ch:8443/srm/managerv2?SFN="
rootpath = srmpath+"/pnfs/lcg.cscs.ch/cms/trivcat/"
else:
parser.error('site can be either t3psi or t2cscs')
srmPath = rootpath+dir
print "srmls "+srmPath
srmls = subprocess.Popen(['srmls',srmPath])
srmls.wait()
if __name__ == '__main__':
main()