Fix broken pipe errors on directories