Will it delete the old file? No, it won't. Should have been filename.delete();