docs: def cp_to_noexistent_destination(args, dest_path, dx_dest, dest_proj):
      ''' Copy the source to a destination that does not currently
      exist. This involves creating the target file/folder.
      '''
      # Destination folder path is new => renaming
      if len(args.sources) != 1:
          # Can't copy and rename more than one object
          raise DXCLIError('The destination folder does not exist')
      last_slash_pos = get_last_pos_of_char('/', dest_path)
      if last_slash_pos == 0:
          dest_folder = '/'
      else:
          dest_folder = dest_path[:last_slash_pos]
      dest_name = dest_path[last_slash_pos + 1:].replace('\/', '/')
      try:
          dx_dest.list_folder(folder=dest_folder, only='folders')
      except dxpy.DXAPIError as details:
          if details.code == requests.codes['not_found']:
              raise DXCLIError('The destination folder does not exist')
          else:
              raise
      except:
          err_exit()
  
      # Clone and rename either the data object or the folder.
      # src_result is None if it could not be resolved to an object.
      src_proj, src_path, src_results = try_call(resolve_existing_path,
                                                 args.sources[0],
                                                 allow_mult=True, all_mult=args.all)
  
      if src_proj == dest_proj:
          if is_hashid(args.sources[0]):
              # This is the only case in which the source project is
              # purely assumed, so give a better error message.
              raise DXCLIError(fill('Error: You must specify a source project for ' + args.sources[0]))
          else:
              raise DXCLIError(fill('A source path and the destination path resolved to the ' +
                                  'same project or container.  Please specify different source ' +
                                  'and destination containers, e.g.') +
                               '\n  dx cp source-project:source-id-or-path dest-project:dest-path')
  
      if src_results is None:
          try:
              contents = dxpy.api.project_list_folder(src_proj,
                                                      {"folder": src_path, "includeHidden": True})
              dxpy.api.project_new_folder(dest_proj, {"folder": dest_path})
              exists = dxpy.api.project_clone(src_proj,
                                              {"folders": contents['folders'],
                                               "objects": [result['id'] for result in contents['objects']],
                                               "project": dest_proj,
                                               "destination": dest_path})['exists']
              if len(exists) > 0:
                  print(fill('The following objects already existed in the destination ' +
                             'container and were not copied:') + '\n ' + '\n '.join(exists))
                  return
          except:
              err_exit()
      else:
          try:
              exists = dxpy.api.project_clone(src_proj,
                                              {"objects": [result['id'] for result in src_results],
                                               "project": dest_proj,
                                               "destination": dest_folder})['exists']
              if len(exists) > 0:
                  print(fill('The following objects already existed in the destination ' +
                             'container and were not copied:') + '\n ' + '\n '.join(exists))
              for result in src_results:
                  if result['id'] not in exists:
                      dxpy.DXHTTPRequest('/' + result['id'] + '/rename',
                                         {"project": dest_proj,
                                          "name": dest_name})
              return
          except:
              err_exit()