Bug? Files added manually to Notes folder are not picked up as Notes or synced


#1

I am not sure if this is a bug so I haven’t put it on github as an issue. It’s maybe more of a feature request.

I have a Nextcloud installation on a hosting account where I also have shell access. I like the Notes app in NC as a front-end for producing Markdown files that are backed-up immediately (and also synced to my local machine via the Nextcloud app). I notice that the Markdown files created by Notes are simply saved in a sub-folder of Nextcloud’s files (files/Notes) and can also be accessed by the NC Files app. I got excited by this, because I thought that NC Notes might become a really nice front-end for creating and editing Markdown files for posts on a blog system like Jekyll or Pelican.

This is great.

However, what would be even greater would be if I could create new notes that were readable by the Notes app simply by creating a new text file from the shell (> nano files/Notes/something.md). I notice that such files, even though placed in the correct folder, are not recognised or listed by the Notes app, and what’s more they are not even synced by the Nextcloud app on my desktop. It’s as if they don’t exist to NC.

I understand that creating a file in this way may be short-circuiting the way that Notes creates and registers its notes, but I don’t really understand why the files would not by picked up by the overall sync system.

Any ideas?

PS I tried to add “notes” as an optional tag to this topic but the interface would not let me create a new tag.


#2

You’re right, this isn’t a bug; you’re short-circuiting Nextcloud’s database, which would like to know the current state of its files at all times. What you can do is to set off a periodic scan, so that Nextcloud will “find” and add these new files to its database. See Adding files to external storages for an example of how to set up such a scan using the occ command.

You’ll notice that says external storages - while the same method does work with files inside Nextcloud’s data folder, I’d recommend setting it up as an “external” folder, even if it’s a local one. The Notes app does have a setting for storing/viewing notes in any folder that’s included in the Nextcloud system, even as an external.

An example of how this might look:

  • Nextcloud is in /var/www/nextcloud, with its data folder, etc
  • Blog posts are in /srv/blog/ as .txt or .md markdown files.
    • This is added as a local external folder in Nextcloud, say as “Blog posts”.
    • The Notes app is set to use this folder (which you can change at any time).
    • Nextcloud’s scanning of this folder is part of an automated cron job, or part of your blog update routine.
  • Jeckyll/Pelican/etc builds the markdown files into /var/www/blog, where they’re served statically.

You may also be interested in the Markdown Editor app as an editing front end, which has a live preview separate from the editing window. It still needs the scans mentioned above, but I’ve found it more consistent across desktop browsers. I still use Notes for many things (especially if I want to edit from Android), but Markdown Editor is worth a look if you haven’t seen it.


#3

Thank you, thank you thank you @mactrent - awesome reply to my slightly giddy and arrogant post!

Thank you for explaining so helpfully what I had kind of wondered about - I now understand better what the issue is and why I can’t simply post things into a folder. (I suppose I was thinking by analogy of the way in which you can simply add files to a folder on your local machine and they get picked up by the NC sync program and added to Files).

The set-up you suggest with NC picking up files from an external directory would work fine for me, I suppose that was my Plan B but it’s great to see that that would work really easily.

I’ll have a look at the Markdown editor app too.