parse splits, rename if only one split

This commit is contained in:
q
2025-02-14 11:56:59 +02:00
parent 7568fc475b
commit 015fd95366

View File

@@ -1,6 +1,6 @@
#!/bin/bash
VERSION="20250208"
VERSION="20250214"
function helpexit() {
BS=$( basename "$0" )
@@ -93,6 +93,12 @@ for ((i=1; i<=${#@}; i++)) {
which pv &>/dev/null || { echo pv command missing; exit 1; }
if [[ -n "$SPLIT" ]]; then
which split &>/dev/null || { echo split command missing; exit 1; }
if [[ "$SPLIT" =~ ^[0-9]+$ ]] || [[ "$SPLIT" =~ ^[0-9]+[KMGTPEZ]$ ]] || [[ "$SPLIT" =~ ^[0-9]+[KMGTPEZ]B$ ]]; then
true
else
echo "Cannot parse: $SPLIT. use ex. 500G. valid extension K M G T P E Z"
exit 1
fi
fi
if tar --version | grep -q GNU; then
SORTFILES="--sort=name"
@@ -136,6 +142,13 @@ for d in "${REALFOLDERS[@]}"; do
-d "$NEWEST" \
"$d.${SUFFIX}".*[0123456789] \
"$d.${SUFFIX}.lst"
shopt -s nullglob
set -- "$d.${SUFFIX}".*[0123456789]
if [[ $# -eq 1 ]]; then
echo "Split produced only one file:"
mv -v "$d.${SUFFIX}".*[0123456789] "$d.${SUFFIX}"
fi
shopt -u nullglob
else
touch \
-d "$NEWEST" \