-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_remap_dirs_to_share.tcsh
executable file
·99 lines (78 loc) · 2.59 KB
/
copy_remap_dirs_to_share.tcsh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/tcsh -f
# Script from Matt Thompson, modified by Rob Lucchesi
#
# NOTE: If the script complains aobut duplicate directories,
# the following sequence of BASH command lines can be used in
# source directory to compare with the files at the target
# directory in $SHARE/gmao_ops.
#
# find . -type f | while read file; do if [ -e /discover/nobackup/projects/gmao/share/gmao_ops/$file ]; then ls -l /discover/nobackup/projects/gmao/share/gmao_ops/$file; fi; done
# find . -type f | while read file; do if [ -e /discover/nobackup/projects/gmao/share/gmao_ops/$file ]; then cmp $file /discover/nobackup/projects/gmao/share/gmao_ops/$file; fi; done
#
#
#
# ------------------------------
# Process command line arguments
# ------------------------------
if ($#argv != 4) then
goto usage
endif
while ($#argv)
if ( ( "$1" != "-levs" ) && ( "$1" != "-indir") ) then
goto usage
endif
if ("$1" == "-levs") then
shift; if (! $#argv) goto usage
set numlevs = $1
endif
if ("$1" == "-indir") then
shift; if (! $#argv) goto usage
set indir = "$1"
endif
shift
end
set SHAREDIR = "/discover/nobackup/projects/gmao/share/gmao_ops"
set LEVDIR = "L$numlevs"
set WORKDIR = $indir
echo "Copying $LEVDIR files from $WORKDIR to $SHAREDIR"
# -------
# fvInput
# -------
set FVINPUT_TYPES = ( AeroCom CMIP MERRA2 NR )
foreach TYPE ( `echo $FVINPUT_TYPES` )
echo "Working on $TYPE..."
if ( -d $SHAREDIR/fvInput/$TYPE/$LEVDIR ) then
echo "WARNING! $SHAREDIR/fvInput/$TYPE/$LEVDIR exists!"
echo -n "\n Make sure you are not overwriting files. Do you wish to continue? [y/n] "
set reply = $<
if ( "$reply" != "y" ) then
exit 1
endif
endif
cp -rv $WORKDIR/fvInput/$TYPE/$LEVDIR $SHAREDIR/fvInput/$TYPE
end
# -----------
# fvInput_nc3
# -----------
if ( -d $SHAREDIR/fvInput_nc3/g5chem/$LEVDIR ) then
echo "WARNING! $SHAREDIR/fvInput_nc3/g5chem/$LEVDIR exists!"
echo -n "\n Make sure you are not overwriting files. Do you wish to continue? [y/n] "
set reply = $<
if ( "$reply" != "y" ) then
exit 1
endif
endif
cp -rv $WORKDIR/fvInput_nc3/g5chem/$LEVDIR $SHAREDIR/fvInput_nc3/g5chem/
if ( -d $SHAREDIR/fvInput_nc3/g5gcm/moist/$LEVDIR ) then
echo "WARNING! $SHAREDIR/fvInput_nc3/g5gcm/moist/$LEVDIR exists!"
echo -n "\n Make sure you are not overwriting files. Do you wish to continue? [y/n] "
set reply = $<
if ( "$reply" != "y" ) then
exit 1
endif
endif
cp -rv $WORKDIR/fvInput_nc3/g5gcm/moist/$LEVDIR $SHAREDIR/fvInput_nc3/g5gcm/moist/
usage:
cat <<EOF
usage: $0:t -levs numlevels -indir INDIR
EOF