code: def _write_directory_records(self, vd, outfp, progress):
          '''
          An internal method to write out the directory records from a particular
          Volume Descriptor.
          Parameters:
           vd - The Volume Descriptor to write the Directory Records from.
           outfp - The file object to write data to.
           progress - The _Progress object to use for outputting progress.
          Returns:
           Nothing.
          '''
          log_block_size = vd.logical_block_size()
          le_ptr_offset = 0
          be_ptr_offset = 0
          dirs = collections.deque([vd.root_directory_record()])
          while dirs:
              curr = dirs.popleft()
              curr_dirrecord_offset = 0
              if curr.is_dir():
                  if curr.ptr is None:
                      raise pycdlibexception.PyCdlibInternalError('Directory has no Path Table Record')
                  outfp.seek(vd.path_table_location_le * log_block_size + le_ptr_offset)
                  ret = curr.ptr.record_little_endian()
                  self._outfp_write_with_check(outfp, ret)
                  le_ptr_offset += len(ret)
                  outfp.seek(vd.path_table_location_be * log_block_size + be_ptr_offset)
                  ret = curr.ptr.record_big_endian()
                  self._outfp_write_with_check(outfp, ret)
                  be_ptr_offset += len(ret)
                  progress.call(curr.get_data_length())
              dir_extent = curr.extent_location()
              for child in curr.children:
                  recstr = child.record()
                  if (curr_dirrecord_offset + len(recstr)) > log_block_size:
                      dir_extent += 1
                      curr_dirrecord_offset = 0
                  outfp.seek(dir_extent * log_block_size + curr_dirrecord_offset)
                  self._outfp_write_with_check(outfp, recstr)
                  curr_dirrecord_offset += len(recstr)
                  if child.rock_ridge is not None:
                      if child.rock_ridge.dr_entries.ce_record is not None:
                          ce_rec = child.rock_ridge.dr_entries.ce_record
                          outfp.seek(ce_rec.bl_cont_area * self.pvd.logical_block_size() + ce_rec.offset_cont_area)
                          rec = child.rock_ridge.record_ce_entries()
                          self._outfp_write_with_check(outfp, rec)
                          progress.call(len(rec))
                      if child.rock_ridge.child_link_record_exists():
                          continue
                  if child.is_dir():
                      if not child.is_dot() and not child.is_dotdot():
                          dirs.append(child)