This answer is elaborated from David Carlisle's comment, in case it helps someone. Since \input cannot be changed in such a way, there are basically two strategies:
Let latex now about the file globally, ideally by adding header.tex to ~/texmf/tex/latex/<username>, or to the variable TEXINPUTS. More details on this answer. In my case, I wanted my files to be self-contained in a single directory (for git), so I went with the second option.
Write a script that goes into each directory, run pdflatex and so on. This is the option I used.
First, I generate a list of all tex files and store if in listOfTeX.txt (to be ran from the parent directory):
find . -type f \( -iname "$.tex" \) >> listOfTeX.txt
Then,
while read FILE; do
printf "\n ----> $FILE\n"; # prints the file path and name
DIR=$(dirname "$FILE"); # extracts the directory
cd $DIR; # goes to that directory
texfot pdflatex $(basename "$FILE") | grep "error"; # run pdflatex
cd ../; # goes back to the parent directory (in my case)
done < listOfTeX.txt
Explanations on the line texfot pdflatex $(basename "$FILE") | grep "error"; : texfot is used to reduce the output of pdflatex, see egreg's answer. Then I use grep "error" to display only the errors. That allows to directly find the problematic files and paths. To be adjusted to your needs of course (same for cd ../).
\input{header}and arrange that/useris in TEXINPUTS then it will work from anywhere just asarticle.clsgets input wherever you are as it is in TEXINPUTS – David Carlisle Nov 07 '17 at 23:13