-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcopy_slf.sh
34 lines (28 loc) · 1.02 KB
/
copy_slf.sh
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
#!/usr/bin/bash
# Take the years from the input e.g. bash unzip_for_episode.sh 1718 1819
years=$@
if [ -z $1 ]; then
echo "You need to provide one or more years in the form 'bash unzip_for_episode.sh 1718 1819'"
exit 1
fi
# Set folders
input_folder=/conf/sourcedev/Source_Linkage_File_Updates
output_folder=/conf/hscdiip/01-Source-linkage-files
# Create a file to alert anyone
echo "DON'T PANIC!" >$output_folder/Update-In-Progress.txt
# Take the years from the input e.g. ./copy_slf.sh 1718 1819
years=$@
for year in $years; do
# Set the files to be writeable
chmod 640 $output_folder/*$year.*
# Copy the files for the given year
cp -vt $output_folder/ \
$input_folder/$year/source-episode-file-20$year.zsav \
$input_folder/$year/source-episode-file-20$year.fst \
$input_folder/$year/source-individual-file-20$year.zsav \
$input_folder/$year/source-individual-file-20$year.fst
# Set the files back to read-only
chmod 440 $output_folder/*$year.*
done
# Remove the warning message
rm $output_folder/Update-In-Progress.txt