Took a while to find it out:
find -type f -execdir bash -c 'var=$(basename "$PWD"); mv -- "$1" "${var%-*}_$(cut -c 3- < <(echo ${1}))"' execbash {} \;
Also useful: Copy all files of type jpg to one directory:
find . -type f -name '*.jpg'| xargs cp -t /media/ana/Daten/jpgAlle
This has probably to be repeated with file ending JPG and jpeg
- Tags
- bash