[digiKam-users] removing orphaned xmp files under Linux

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


Am 08.03.2018 um 10:00 schrieb Peter Mc Donough:
> Am 08.03.2018 um 03:30 schrieb woenx:
>> I'm not a bash expert whatsoever, but I think this could work, I based 
>> it on
...

Tested, but my Kubuntu's Bash doesn't like "shopt", error message below.
I supose a shell option. It probably has to be activated somehow:

Any ideas
Peter

-----------------
Error Message:
/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")

> shopt -s nullglob extglob;
> 
> # Get all sidecar files
> for file in *.{xmp,pts,pp3}
> do
>    # 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"
> done
> #




More information about the Digikam-users mailing list