exiftool
would be my tool of choice for this. First make sure exiftool
is installed:
sudo apt-get install libimage-exiftool-perl
Now for the interesting part, assigning the Metadata tag to your filename. exiftool
can source the content of metadata fields from other information such as the filename. It can also perform basic text processing steps on the sourced information.
With that in mind we can construct a command that will read the filename, remove the extension, and assign it as the content of both Title
metadata fields found in pdf files (PDF:Title and XMP-dx:Title):
exiftool '-PDF:Title<${filename;s/\..*?$//}' '-XMP-dc:Title<${filename;s/\..*?$//}' file.pdf
Quick breakdown of the command sequences:
Further reading:
http://130.15.24.88/exiftool/forum/index.php?topic=4779.0
http://130.15.24.88/exiftool/forum/index.php?topic=4595.0