add a new file with detection