Do less syscalls in mkpath