docs: function updatePathWithStats(sourcePath, sourceStats, targetPath, targetStats, options, log) {
      var updated = false;
  
      var rootDir = (options && options.rootDir) || "";
      var copyAll = (options && options.all) || false;
  
      var targetFullPath = path.join(rootDir || "", targetPath);
  
      if (sourceStats) {
          var sourceFullPath = path.join(rootDir || "", sourcePath);
  
          if (targetStats) {
              // The target exists. But if the directory status doesn't match the source, delete it.
              if (targetStats.isDirectory() && !sourceStats.isDirectory()) {
                  log("rmdir  " + targetPath + " (source is a file)");
                  shell.rm("-rf", targetFullPath);
                  targetStats = null;
                  updated = true;
              } else if (!targetStats.isDirectory() && sourceStats.isDirectory()) {
                  log("delete " + targetPath + " (source is a directory)");
                  shell.rm("-f", targetFullPath);
                  targetStats = null;
                  updated = true;
              }
          }
  
          if (!targetStats) {
              if (sourceStats.isDirectory()) {
                  // The target directory does not exist, so it should be created.
                  log("mkdir " + targetPath);
                  shell.mkdir("-p", targetFullPath);
                  updated = true;
              } else if (sourceStats.isFile()) {
                  // The target file does not exist, so it should be copied from the source.
                  log("copy  " + sourcePath + " " + targetPath + (copyAll ? "" : " (new file)"));
                  shell.cp("-f", sourceFullPath, targetFullPath);
                  updated = true;
              }
          } else if (sourceStats.isFile() && targetStats.isFile()) {
              // The source and target paths both exist and are files.
              if (copyAll) {
                  // The caller specified all files should be copied.
                  log("copy  " + sourcePath + " " + targetPath);
                  shell.cp("-f", sourceFullPath, targetFullPath);
                  updated = true;
              } else {
                  // Copy if the source has been modified since it was copied to the target, or if
                  // the file sizes are different. (The latter catches most cases in which something
                  // was done to the file after copying.) Comparison is >= rather than > to allow
                  // for timestamps lacking sub-second precision in some filesystems.
                  if (sourceStats.mtime.getTime() >= targetStats.mtime.getTime() ||
                          sourceStats.size !== targetStats.size) {
                      log("copy  " + sourcePath + " " + targetPath + " (updated file)");
                      shell.cp("-f", sourceFullPath, targetFullPath);
                      updated = true;
                  }
              }
          }
      } else if (targetStats) {
          // The target exists but the source is null, so the target should be deleted.
          if (targetStats.isDirectory()) {
              log("rmdir  " + targetPath + (copyAll ? "" : " (no source)"));
              shell.rm("-rf", targetFullPath);
          } else {
              log("delete " + targetPath + (copyAll ? "" : " (no source)"));
              shell.rm("-f", targetFullPath);
          }
          updated = true;
      }
  
      return updated;
  }