Add output function and append current time to output.
Fix for paths with spaces.