-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclean.sh
executable file
·50 lines (39 loc) · 1.21 KB
/
clean.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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "MARFA" ]; then
echo "Error: This script must be run from the MARFA directory."
exit 1
fi
prompt_user() {
local action_desc="$1"
local command="$2"
while true; do
read -p "Do you want to ${action_desc}? (y/n): " yn
case $yn in
[Yy]* )
echo "Executing: ${command}"
eval "$command"
break
;;
[Nn]* )
echo "Skipping: ${action_desc}"
break
;;
* )
echo "Please answer y or n."
;;
esac
done
}
prompt_user "delete dependencies and .mod files (new build will be required)" \
'find ./src -type f -name "*.mod" -exec rm -f {} + && find ./build -mindepth 1 -exec rm -rf {} +'
prompt_user "delete all previous PT-tables calculated" \
'rm -rf ./output/ptTables/*'
prompt_user "delete all human-readable absorption data" \
'rm -rf ./output/processedData/*'
prompt_user "delete all plots" \
'rm -rf ./output/plots/*'
prompt_user "remove old .par files from all directories" \
'find . -type f -name "*.par" -exec rm -f {} +'
prompt_user "remove old .dat files ONLY from the root directory" \
'find . -maxdepth 1 -type f -name "*.dat" -exec rm -f {} +'