use builtin file / dir methods instead of shelling out