[digiKam-users] removing orphaned xmp files under Linux

Jürgen Blumenschein blumenschein at dokom.net
Sun Mar 11 13:26:41 GMT 2018

Try this short script with the find command (But please, use it at  
your own risk.):

find [searchpath] -name "*.xmp" -execdir  
[path-to-script]/orphaned-xmp.sh "{}" \;

[juergen at tuxedo ~]$ cat ~/bin/orphaned-xmp.sh
if [ $# -ne 1 ]; then
         echo $0 entfernt verwaiste xmp-Dateien: nur ein Dateiname als  
Argument ist erlaubt ;
         echo $0 deletes orphaned xmp-files: only one filename as argument ;
         exit ;

bName="$(basename "$Name" .xmp)"
#echo arg count = $#, file "$Name", basename: "$bName"
if [ ! -f "$bName" ]; then
         echo "$Name" exists but "$bName" not ;
         rm --interactive --verbose "$Name";
#       echo "$Name" is not orhaned ;

Each file has to be confirmes. If you don't want this delete  
"--interactive" in the script source.


Zitat von Peter Mc Donough <mcd-mail-lists at gmx.net>:

> Hi,
> I noticed that there are some orphaned xmp-files in my photo folders.
> Does anybody know some command line magic for Linux for at least  
> finding them?
> cuPeter

Jürgen Blumenschein, eMail: blumenschein at dokom.net
Homepage: http://members.dokom.net/blumenschein
Am Quartus 17
D-44149 Dortmund
Tel.: +49 231 7217321, Handy: +49 176 5591 4562
public key:  

More information about the Digikam-users mailing list