build and read directories appropriately for the type of filesystem