Added logic to copy file to target directory