[digiKam-users] removing orphaned xmp files under Linux

Peter Mc Donough mcd-mail-lists at gmx.net
Thu Mar 8 11:45:25 GMT 2018

Am 08.03.2018 um 12:28 schrieb Peter Mc Donough:

I better add the complete shell script


# 20180308 - entfernen ueberfluessiger "xmp/pts/pp3" -Dateien
shopt -s nullglob extglob;

# Get all sidecar files
for file in *.{xmp,pts,pp3}
   # Generate all permutations of filenames that it may belong to,
   # and let globbing delete the ones that don't exist
   candidates=("${file%.*}"@() "${file%.*}".{nef,raf,orf}@());

   # If none exist, the file can be deleted
   [[ ${#candidates[@]} -eq 0 ]] && echo rm "$file"

Error message:
peter at kubu2-lux:~/temp/oldies_mcd/2$ sh  ~/foto_xmp_ex.sh
/home/peter/foto_xmp_ex.sh: 5: /home/peter/foto_xmp_ex.sh: shopt: not found
/home/peter/foto_xmp_ex.sh: 12: /home/peter/foto_xmp_ex.sh: Syntax 
error: "(" unexpected (expecting "done")
peter at kubu2-lux:~/temp/oldies_mcd/2$

More information about the Digikam-users mailing list