To have fast exif batch processing of stored images in Photo Station, I tried to use the exiftool directly on my Synology DS218+ NAS.
Installing Perl
As the exiftool requires Perl, install the Perl package, available from the Synology Package Center:
Connect to the Synology NAS via ssh, as an admin user. Now, Perl should be available, check the version:
admin@nimbus:~$ perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2016, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
admin@nimbus:~$
Getting the exiftool
Get the latest exiftool package:
wget https://exiftool.org/Image-ExifTool-11.88.tar.gz
# unpack and use it
gzip -dc Image-ExifTool-11.88.tar.gz | tar -xf -
cd Image-ExifTool-11.88
# Check version (optionally)
perl exiftool -v
Usage
It’s not possible to use the exiftool directly from it’s installation directory when using the -r (recursive) option. The current directory must be the directory to start from. So first change to the photo station directory (or any other directory you need to work in):
cd /volume1/photos/
Then invoke the exiftool from there, using it’s installation path (Alternatively add the exiftool’s directory to the PATH variable first).
The following example, adapted from my previous post, tags all received WhatsApp images with the “WhatsApp” keyword:
# Tagging WhatsApp images
perl ~/Image-ExifTool-11.88/exiftool -if '$filename=~/^IMG-\d{8}-WA\d{4}\.\w*/' -if 'not defined $Keywords or $Keywords!~/WhatsApp/i' '-Keywords+=WhatsApp' -v -overwrite_original -r -i '@eaDir' -ext JPG . -fast2
Running in the background
To run your (long-running) command without a continuously connected ssh session, use the nohup
command. The well-known screen
command is not available on a Synology NAS:
nohup perl ~/Image-ExifTool-11.88/exiftool -if '$filename=~/^IMG-\d{8}-WA\d{4}\.\w*/' -if 'not defined $Keywords or $Keywords!~/WhatsApp/i' '-Keywords+=WhatsApp' -v -overwrite_original -r -i '@eaDir' -ext JPG . -fast2 &