Set file/directory modes appropriately