+ return true;
+}
+
+/*
+ * For a given path lookup the most recent backup in the catalog
+ * to get the JobId and FileIndexes of all files in that directory.
+ */
+static bool insert_dir_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *dir,
+ char *date)
+{
+ char ed1[50];
+
+ strip_trailing_junk(dir);
+ if (*rx->JobIds == 0) {
+ bsendmsg(ua, _("No JobId specified cannot continue.\n"));
+ return false;
+ } else {
+ Mmsg(rx->query, uar_jobid_fileindex_from_dir, rx->JobIds,
+ dir, rx->ClientName);
+ }
+ rx->found = false;
+ /* Find and insert jobid and File Index */
+ if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
+ bsendmsg(ua, _("Query failed: %s. ERR=%s\n"),
+ rx->query, db_strerror(ua->db));
+ }
+ if (!rx->found) {
+ bsendmsg(ua, _("No database record found for: %s\n"), dir);
+ return true;
+ }
+ /*
+ * Find the MediaTypes for this JobId and add to the name_list
+ */
+ Mmsg(rx->query, uar_mediatype, edit_int64(rx->JobId, ed1));
+ if (!db_sql_query(ua->db, rx->query, unique_name_list_handler, (void *)&rx->name_list)) {
+ bsendmsg(ua, "%s", db_strerror(ua->db));
+ return false;
+ }
+ return true;
+}
+
+/*
+ * Get the JobId and FileIndexes of all files in the specified table
+ */
+static bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table)
+{
+ char ed1[50];
+
+ strip_trailing_junk(table);
+ Mmsg(rx->query, uar_jobid_fileindex_from_table, table);
+
+ rx->found = false;
+ /* Find and insert jobid and File Index */
+ if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
+ bsendmsg(ua, _("Query failed: %s. ERR=%s\n"),
+ rx->query, db_strerror(ua->db));
+ }
+ if (!rx->found) {
+ bsendmsg(ua, _("No table found: %s\n"), table);
+ return true;
+ }
+ /*
+ * Find the MediaTypes for this JobId and add to the name_list
+ */
+ Mmsg(rx->query, uar_mediatype, edit_int64(rx->JobId, ed1));
+ if (!db_sql_query(ua->db, rx->query, unique_name_list_handler, (void *)&rx->name_list)) {
+ bsendmsg(ua, "%s", db_strerror(ua->db));
+ return false;
+ }
+ return true;