Extracted path creation to prevent command duplication when creating directory trees