optimierungen
This commit is contained in:
parent
b1e072678f
commit
12653d3bf1
1 changed files with 18 additions and 1 deletions
19
cutname.sh
19
cutname.sh
|
@ -5,8 +5,25 @@ set -x
|
||||||
while (( "$#" ))
|
while (( "$#" ))
|
||||||
do
|
do
|
||||||
|
|
||||||
mv ${1} ${1%%-*}
|
cd "${1%/*}" # gehe ins Verzeichnis
|
||||||
|
|
||||||
|
FILENAME=${1##*/} # Dateiname ist alles ab dem letzten '/'
|
||||||
|
echo "$FILENAME"
|
||||||
|
|
||||||
|
if ! [ -d ${FILENAME%%-*} ]; then
|
||||||
|
|
||||||
|
mv ${FILENAME} ${FILENAME%%-*}
|
||||||
|
else
|
||||||
|
|
||||||
|
number=1
|
||||||
|
while [ -d ${FILENAME%%-*}${number} ]
|
||||||
|
do
|
||||||
|
number=`expr ${number} + 1`
|
||||||
|
done
|
||||||
|
mv ${FILENAME} ${FILENAME%%-*}${number}
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd -
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue