-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathremove_xmp_without_image
More file actions
executable file
·43 lines (39 loc) · 1.11 KB
/
Copy pathremove_xmp_without_image
File metadata and controls
executable file
·43 lines (39 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -
#===============================================================================
#
# FILE: remove_xmp_without_image.sh
#
# USAGE: remove_xmp_without_image.sh suchpfad
#
# DESCRIPTION: Löscht XMP-Dateien, zu denen im gleichen Verzeichnis keine Bilder
# mehr existieren
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Andreas Böttger (aboettger), andreas.boettger@gmx.de
# ORGANIZATION:
# CREATED: 15.04.2014 20:00
# REVISION: ---
#===============================================================================
#set -o nounset # Treat unset variables as an error
if [ "$1" == "" ]
then
echo "USAGE: remove_xmp_without_image.sh suchpfad"
exit 1
fi
shopt -s nullglob
shopt -s nocaseglob
find "$1" -depth -type d | { while read -r D;
do
find "$D" -type f -maxdepth 1 -name '*.xmp' | { while read -r xmp;
do
if [ ! -f "${xmp%.*}" ]
then
echo "xmp ($xmp) vorhanden, aber kein passendes Bild ${xmp%.*}"
rm "$xmp"
fi
done }
done }
exit 0