write to directory