  
  /* Commands sent to File daemon */
  static char backupcmd[] = "backup\n";
-@@ -97,6 +98,413 @@
+@@ -96,7 +97,443 @@
+    return true;
  }
  
++static int accurate_list_handler(void *ctx, int num_fields, char **row)
++{
++   JCR *jcr = (JCR *)ctx;
++
++   if (job_canceled(jcr)) {
++      return 1;
++   }
++   
++   if (row[0] > 0) {
++      jcr->file_bsock->fsend("%s%s%c%s", row[1], row[2], 0, row[3]); 
++   }
++   return 0;
++}
++
++bool accurate_send_current_files(JCR *jcr)
++{
++   char buf[MAXSTRING];
++   char ed1[50], ed2[50];
  /*
++ CREATE TEMPORARY TABLE btemp2 AS (
++  SELECT max(FileId) as FileId, PathId, FilenameId 
++    FROM (SELECT FileId, PathId, FilenameId FROM File WHERE JobId IN (39867,40341)) AS F
++   GROUP BY PathId, FilenameId )
++
++  SELECT File.FileIndex, Path.Path, Filename.Name, File.LStat
++    FROM btemp2 JOIN Path USING (PathId) JOIN Filename USING (FilenameId)
++                JOIN File USING (FileId)
++   WHERE File.FileIndex > 0
++
++
++SELECT DISTINCT ON (PathId, FilenameId) FileIndex, Path, Name, LStat
++  FROM File JOIN Filename USING (FilenameId) JOIN Path USING (PathId) WHERE JobId IN (40341)
++ ORDER BY PathId, FilenameId, JobId DESC
++*/
++   bsnprintf(buf, sizeof(buf),
++	     "SELECT DISTINCT ON (PathId, FilenameId) FileIndex, Path, Name, LStat "
++	      "FROM File JOIN Filename USING (FilenameId) JOIN Path USING (PathId) WHERE JobId IN (%s)"
++              "ORDER BY PathId, FilenameId, JobId DESC",
++	     "10,20,30");	/* jobid */
++
++   Dmsg1(2, "display current files cmd=%s\n", buf);
++   db_sql_query(jcr->db, buf, accurate_list_handler, (void *)jcr);
++   jcr->file_bsock->signal(BNET_EOD);
++   return true;
++}
++
++/*
 + * We are called here for each record that matches the above
 + *  SQL query -- that is for each file contained in the Catalog
 + *  that was not marked earlier. This means that the file in
 + *  question is a missing file (in the Catalog but not on Disk).
 + */
-+static int missing_handler(void *ctx, int num_fields, char **row)
-+{
-+   JCR *jcr = (JCR *)ctx;
-+
-+   if (job_canceled(jcr)) {
-+      return 1;
-+   }
-+
-+   /* TODO: return the list to the FD */
-+   if (num_fields == 2) 
-+      Qmsg(jcr, M_INFO, 0, "      %s%s\n", row[0]?row[0]:"", row[1]?row[1]:"");
-+   else
-+      Qmsg(jcr, M_INFO, 0, "      %s\n", row[0]?row[0]:"");
-+ 
-+   return 0;
-+}
-+
 +/* TODO: tweak verify code to use the same function */
 +bool accurate_check_file(JCR *jcr, FILE_DBR *fdbr, char *attr, char *Opts_Digest, int *do_Digest)
 +{

 /*
  * Get a File record
  * Returns: 0 on failure
Index: src/jcr.h
===================================================================
--- src/jcr.h	(rvision 6372)

    sd = jcr->store_bsock;
 
    set_jcr_job_status(jcr, JS_Running);
@@ -134,6 +238,20 @@
       ok = false;                     /* error */
       set_jcr_job_status(jcr, JS_ErrorTerminated);
    }
