[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 "{}" \;

Skript:
[juergen at tuxedo ~]$ cat ~/bin/orphaned-xmp.sh
#!/bin/bash
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 ;
fi

Name=$1
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";
#else
#       echo "$Name" is not orhaned ;
fi

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

Jürgen

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:  
http://members.dokom.net/blumenscheinJuergen_Blumenschein_(0xC9358EBB)_public_key.asc




More information about the Digikam-users mailing list