substituteAllFiles: add derivation

Closes #4145