-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro_batch.sh
38 lines (29 loc) · 937 Bytes
/
astro_batch.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
35
36
37
38
#!/bin/bash
# DSS TOOLS
# The purpose of this script is to move files, copied from the ASIAIR, into directories
# that are created for each unique channel (astronomical filter).
#
# This script processes a single channel, as specified on the command line.
#
# For example, if hundreds of files are copied from the ASIAIR into a single local folder, then the file names
# will have _L_, _R_, _G_, _B_ in the filename.
#
# NOTE: On the ASIAIR, you must name your filters simply as follows:
# L R G B H O S
# Filter portion of name is uppercase
f=$1
FILTER=${f^^}
FILES="*_"$FILTER"_*fit"
if [ $(find . -name "$FILES" | wc -l) = "0" ]
then
echo "There are no '.fit' files for the $FILTER channel"
exit 0
fi
echo "Organising data for: $FILTER"
[ ! -d ./$1 ] && mkdir ./$1
find . -maxdepth 1 -name "$FILES" -exec mv {} ./$1 \;
files=$(ls ./$1/*.fit 2> /dev/null | wc -l)
if [ "$files" != "0" ]
then
chmod 440 ./$1/*
fi