-
Notifications
You must be signed in to change notification settings - Fork 0
/
script2.sh
28 lines (21 loc) · 882 Bytes
/
script2.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
#!/bin/bash
# Set the directory where your files are located
input_dir="/home/jorge/Documents/data/vvvxtiles/raw/VVV_Bulge_poslon_upperSgr3"
output_file="/home/jorge/combined_output.fits"
# Create an array to store the list of files
files=("$input_dir"/*.fits)
# Check if there are at least 2 files to merge
if [ ${#files[@]} -lt 2 ]; then
echo "Not enough files to merge."
exit 1
fi
# Initialize the output file with the first two files
temp_file="/tmp/temp_combined_$(date +%s%N).fits"
python main.py -f1 "${files[0]}" -f2 "${files[1]}" -o "$temp_file"
# Iterate through the remaining files and merge them with the output file
for ((i=2; i<${#files[@]}; i++)); do
python main.py -f1 "${files[i]}" -f2 "$temp_file" -o "$temp_file"
done
# Rename the final combined file to the desired output name
mv "$temp_file" "$output_file"
echo "Merged all files into $output_file"