switch from file.base to the calculated dirname for each file