code: def command_copy(args):
      
      sources = args.sources
      destpath = args.destpath
      source_files = []
      for file_ in sources:
          if "*" in file_:
              selected = glob(file_)
              source_files.extend(selected)
          elif os.path.isfile(file_):
              source_files.append(file_)
  
      if destpath.endswith("/") or os.path.isdir(destpath) or len(sources) > 1:
          # -- DESTDIR-MODE: Last argument is a directory.
          destdir = destpath
      else:
          # -- DESTFILE-MODE: Copy (and rename) one file.
          assert len(source_files) == 1
          destdir = os.path.dirname(destpath)
  
      # -- WORK-HORSE: Copy one or more files to destpath.
      if not os.path.isdir(destdir):
          sys.stdout.write("copy: Create dir %s\n" % destdir)
          os.makedirs(destdir)
      for source in source_files:
          destname = os.path.join(destdir, os.path.basename(source))
          sys.stdout.write("copy: %s => %s\n" % (source, destname))
          shutil.copy(source, destname)
      return 0
docs: Copy one or more source-files(s) to a destpath (destfile or destdir).
      Destdir mode is used if:
        * More than one srcfile is provided
        * Last parameter ends with a slash ("/").
        * Last parameter is an existing directory
  
      Destination directory path is created if needed.
      Similar to the UNIX command: 'cp srcfile... destpath'