I have thousands of PDF files named in the format Author Year Title of the bookThe first two spaces are relevant: they make a break between the Author, the year and the title. The title could contain a number of space. I am looking for a script to write the author to the author meta field in the PDF; the Title to the title, and the year to the year metadata.  Exiftool seems the most promising of all the tools I looked at. Can you guys help me?
Write PDF metadata from the file name using Exiftool or PDFtk
command line;pdf;pdftk
Some EXIF manipulation tools have a built-in way to rename files based on EXIF data, but I don't know of one that can do it the other way round. So let the shell call the program with the right parts of the file names. Here's a script that processes just one file (pass the name as the sole argument of the script).#!/bin/shtitle=${1##*/}author=${title%% *}; title=${title#* }year=${title%% *}; title=${title#* }exiftool -Author=$author -Title=$title -CreateDate=$year $1Explanation: I use parameter expansion constructs to perform some basic string processing: put the base name (after the last /) into title; put the part up to the first space into author and remove that from title; repeat with the year.To process all the files in a directory, put that code in a loop.#!/bin/shfor filename in *\ *\ *.pdf; do  title=${filename##*/}  author=${title%% *}; title=${title#* }  year=${title%% *}; title=${title#* }  exiftool -Author=$author -Title=$title -CreateDate=$year $filenamedoneTo process all the files in a directory and its subdirectories recursively, use find.find /path/to/top/directory -name '* * *.pdf' -type f -exec sh -c '  for filename do      done' _ {} +