49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# copy pdf to from tikz to figs
|
|
function main () {
|
|
|
|
|
|
# the absolute project path where is all the stuff, three directories above the script:
|
|
# 3 2 1 0
|
|
# basedir/gnuplot/bin/<script>
|
|
BASEDIR=$(scriptancestorpath 3)
|
|
|
|
# name of the basedir
|
|
BASENAME=$(basename "${BASEDIR}")
|
|
|
|
# Fig_src
|
|
FIG_SRC_DIR="${BASEDIR}"
|
|
|
|
FROM="${FIG_SRC_DIR}/mobius/STINGRAY_Comparison/Solver/./"
|
|
|
|
TO="${FIG_SRC_DIR}/gnuplot"
|
|
|
|
rsync -zarv --prune-empty-dirs --include "*/" --include="Results_results.csv" --exclude="*" "$FROM" "$TO"
|
|
|
|
# compress csv files
|
|
find "${TO}" -path "${TO}/sim_vardelta_T00_*/*" -name "Results_results.csv" | xargs gzip -v
|
|
|
|
}
|
|
|
|
# get the i-th ancestor path of the script that calls this function (the currently running script)
|
|
# i=0: for the path of the script,
|
|
# i=1: for the directory where is the script,
|
|
# i=2: for the directory including the directory corresponding to i=1,
|
|
# etc...
|
|
# $1: level of the ancestor path (from the end of the path)
|
|
scriptancestorpath () {
|
|
[[ $1 -lt 0 ]] && { echo "Ops! Input less than 0: $1"; exit 1; }
|
|
local THEPATH="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
|
|
i=1
|
|
while [[ $i -le ${1} && "${THEPATH}" != "/" ]]; do
|
|
THEPATH="$(cd "$(dirname "$THEPATH")"; pwd)"
|
|
let i=i+1
|
|
done
|
|
# echo "depth: $i"
|
|
echo "${THEPATH}"
|
|
}
|
|
|
|
|
|
main "$@"
|