add mode flag for using serial number to replace or append to the original filename