input directories is expected to be a list, but allow a single string too