-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrm_metadata
More file actions
executable file
·44 lines (35 loc) · 982 Bytes
/
rm_metadata
File metadata and controls
executable file
·44 lines (35 loc) · 982 Bytes
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
44
#!/usr/bin/env bash
# Check if ExifTool is installed
if ! command -v exiftool &>/dev/null; then
echo "ExifTool is not installed. Please install it before running this script."
exit 1
fi
# Check if the argument is provided
if [ -z "$1" ]; then
echo "Please provide a directory or file as an argument."
exit 1
fi
# Check if the argument is a directory
if [ -d "$1" ]; then
directory="$1"
cd "$directory" || exit
# Remove metadata from files in the directory
for file in *; do
if [[ -f "$file" ]]; then
echo "Removing metadata from: $file"
exiftool -all= -overwrite_original "$file"
fi
done
echo "Metadata removal complete."
# Check if the argument is a file
elif [ -f "$1" ]; then
file="$1"
# Remove metadata from the specified file
echo "Removing metadata from: $file"
exiftool -all= -overwrite_original "$file"
echo "Metadata removal complete."
# Invalid argument
else
echo "Invalid argument. Please provide a valid directory or file."
exit 1
fi