Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
srcs
larbatch
scripts
file_to_url.sh
Go to the documentation of this file.
1
#! /bin/bash
2
#----------------------------------------------------------------------
3
#
4
# Name: file_to_url.sh
5
#
6
# Purpose: Convert a filesystem path to an xrootd url.
7
#
8
# Usage:
9
#
10
# file_to_url.sh [-h|--help]
11
# file_to_url.sh <file1> <file2> ...
12
# file_to_url.sh @<filelist>
13
# cat <filelist> | file_to_url.sh
14
#
15
# Notes:
16
#
17
# 1. Pnfs paths are converted to an xrootd url as
18
# /pnfs/... -> root://fndca1.fnal.gov:1094/pnfs/fnal.gov/usr/...
19
#
20
# 2. Other paths (including local and bluearc) are left unchanged.
21
#
22
# 3. Converted files written to standard output, one per line.
23
#
24
#----------------------------------------------------------------------
25
26
# Parse arguments.
27
28
list
=
''
29
nfile=0
30
while
[ $# -gt 0 ];
do
31
case
"$1"
in
32
33
# Help
34
35
-
h
|--
help
)
36
echo
"Usage:"
37
echo
"file_to_url.sh [-h|--help]"
38
echo
"file_to_url.sh <file1> <file2> ..."
39
echo
"file_to_url.sh @<filelist>"
40
echo
"cat <filelist> | file_to_url.sh"
41
exit
42
;;
43
44
# Other unknown options.
45
46
-* )
47
echo
"Unknown option $1"
48
exit
1
49
;;
50
51
# File list.
52
53
@* )
54
list
=`echo $1 | cut -c2-`
55
if
[ ! -f $list ]; then
56
echo
"File list $list not found."
57
else
58
cat $list |
while
read
file
59
do
60
echo $file | sed
's;^/pnfs/;root://fndca1.fnal.gov:1094/pnfs/fnal.gov/usr/;'
61
nfile=$(( $nfile + 1 ))
62
done
63
fi
64
;;
65
66
# Interpret anything as a file name.
67
68
* )
69
file
=$1
70
echo $file | sed
's;^/pnfs/;root://fndca1.fnal.gov:1094/pnfs/fnal.gov/usr/;'
71
nfile=$(( $nfile + 1 ))
72
;;
73
esac
74
shift
75
done
76
77
# Maybe read files from standard input.
78
79
if
[ $nfile -eq 0 ]; then
80
while
read
file
81
do
82
echo $file | sed
's;^/pnfs/;root://fndca1.fnal.gov:1094/pnfs/fnal.gov/usr/;'
83
nfile=$(( $nfile + 1 ))
84
done
85
fi
exit
exit
Definition:
generate_icarus_geometry_splitwire.pl:430
file
* file
Definition:
file_to_url.sh:69
shift
shift
Definition:
fcl_checks.sh:26
h
while getopts h
Definition:
getStatistics.sh:13
fi
then shift fi
Definition:
condor_hadd_sam.sh:174
in
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
Definition:
quiet_Math_Functor_test.sh:23
ICARUSservices.help
string help
Definition:
ICARUSservices.py:124
list
list
Definition:
file_to_url.sh:28
Generated by
1.8.5