View all files regardless of folders

What I’m trying to do

I’m trying to view all the files in my vault regardless of folders-- by last modified. Similar to what apple notes does when you click “All iCloud”

Things I have tried

I tried searching online and reading documentation and could not find anything

In that case, you might like Cards view plugin

I have modified the plugin to integrate more functionalities : Notes Explorer plugin

I don’t want to use data view since I want a result more similar to Apple Notes where it will group files like so:

  • Today
  • Yesterday
  • Last week
  • Last 30 days
  • November
  • Octobober
  • 2021
  • 2020

Also dataview is pretty slow when you have a large number of notes.

I was able to come up with this which emulates the apple notes functionality.

It takes a while to load. And its annoying when you open the note and it’s still in code view. Is there a way to prevent that from happening for easier access?

I wish this was a built in feature but this will do for now. Thanks for the replies.

```dataviewjs
////////////////////////////////////////////////////////////////////////////////
// 1) CONFIG
////////////////////////////////////////////////////////////////////////////////
const TITLE_FONT_SIZE = "1.0em";     // Adjust title size here (e.g., "1.1em", "1.2em", etc)
const FIRST_LINE_SPACING = "-0.7em";  // Adjust spacing here (e.g., "-0.6em", "-0.7em", etc)
const FOLDER_PATH_INDENT = "0px";     // Adjust folder path indent here (e.g., "0px", "20px", etc)
const FIRST_LINE_SCALE = "0.9em";     // Adjust first line font size here
const FOLDER_PATH_SCALE = "0.8em";   // Adjust folder path font size here
const ENTRY_SPACING = "1.0em";       // Adjust spacing between file entries here

const now = new Date();
const currentYear = now.getFullYear();
const DAY_MS = 24 * 60 * 60 * 1000;
const pages = dv.pages("").sort(p => p.file.mtime, 'desc');
function getGroupLabel(mtime) {
   const d = mtime.toJSDate();
   const diffMs = now - d;
   if (diffMs < 1 * DAY_MS) return "Today";
   if (diffMs < 2 * DAY_MS) return "Yesterday";
   if (diffMs < 7 * DAY_MS) return "Last 7 Days";
   if (diffMs < 30 * DAY_MS) return "Last 30 Days";
   return (d.getFullYear() === currentYear)
       ? d.toLocaleString("default", { month: "long" })
       : String(d.getFullYear());
}
function getSelectedFolders(path) {
   const parts = path.split('/');
   parts.pop(); // Remove filename
   
   if (parts.length === 0) return '~';
   if (parts.length === 1) return parts[0];
   if (parts.length === 2) return `${parts[0]}/${parts[1]}`;
   
   return `${parts[0]}/${parts[1]}/.../${parts[parts.length - 1]}`;
}
const groups = {};
for (const pg of pages) {
   const label = getGroupLabel(pg.file.mtime);
   if (!groups[label]) groups[label] = [];
   groups[label].push(pg);
}
const specialGroups = ["Today", "Yesterday", "Last 7 Days", "Last 30 Days"];
let otherLabels = Object.keys(groups).filter(g => !specialGroups.includes(g));
function parseGroupLabel(lbl) {
   if (/^\d{4}$/.test(lbl)) {
       return { type: "year", value: parseInt(lbl, 10) };
   } else {
       const idx = new Date(Date.parse(`${lbl} 1, ${currentYear}`)).getMonth();
       return { type: "month", value: idx };
   }
}
otherLabels.sort((a, b) => {
   const A = parseGroupLabel(a);
   const B = parseGroupLabel(b);
   if (A.type === "month" && B.type === "month") return B.value - A.value;
   if (A.type === "year" && B.type === "year") return B.value - A.value;
   return A.type === "month" ? -1 : 1;
});
async function renderGroup(label) {
   dv.header(3, `${label} (${groups[label].length})`);
   for (const pg of groups[label]) {
       const content = await dv.io.load(pg.file.path).catch(() => "Error loading content");
       const firstLine = content
           .split("\n")
           .find(line => line.trim() !== "") || "No content";
       const sanitizedLine = firstLine.replace(/[#*_~`>|-]/g, "").trim();
       const truncate = (text, maxLength) =>
           text.length > maxLength ? text.slice(0, maxLength) + "..." : text;
       
       const truncatedTitle = truncate(pg.file.name, 40);
       const truncatedFirstLine = truncate(sanitizedLine, 80);
       const folderPath = getSelectedFolders(pg.file.path);
       
       dv.paragraph([
           `<span style="font-size: ${TITLE_FONT_SIZE};">${pg.file.link.withDisplay(truncatedTitle)}</span>`,
           `<div style="margin-left: 20px; color: var(--text-muted); margin-top: ${FIRST_LINE_SPACING}; font-size: ${FIRST_LINE_SCALE};">` +
           `${truncatedFirstLine}` +
           `<div style="font-size: ${FOLDER_PATH_SCALE}; margin-top: 0.1em; color: var(--text-faint); margin-left: ${FOLDER_PATH_INDENT};">` +
           `${folderPath}</div>` +
           `</div>`
       ].join('\n'));

       // Add spacing between entries
       dv.paragraph(`<div style="margin-top: ${ENTRY_SPACING};"></div>`);
   }
}
(async () => {
   for (const lbl of specialGroups) {
       if (groups[lbl]) {
           await renderGroup(lbl);
       }
   }
   for (const lbl of otherLabels) {
       await renderGroup(lbl);
   }
})();

In Search, enable “collapse results, search / (slash), and choose your preferred sort. Unfortunately it’s not as fast as a proper file-browsing view. You can bookmark the search for convenience, tho that won’t save the search settings (they’ll just be whatever you last set them as).