Handle both single file and multiple file modes.