Code Monkey home page Code Monkey logo

joplin-scripts's Introduction

Use at your own risk!

Why are there 2 scripts to remove resources?

The first script jnrmor removes orphaned resources from the database and the meta data files for those resources from the sync target. Due to an error in the Joplin API, the actual resources are not deleted on the sync target. There's where script jnclnst comes to the rescue.

The default locations for the config files are the path of the script and your home directory. These locations will be shown with the option --help.

Requirements

bash version 4 is required for jnclnst. Some scripts use getopt to parse the arguments. Unfortunately the getopt that comes with macOS is a useless piece of shit and can't be used in any useful manner.

macOS

The best way to install proper versions of bash and getopt is to either use MacPorts or brew. Make sure the binaries are in the PATH before /bin and /usr/bin. Another potential dependency is jq (which is required when using newer Joplin versions that stores settings not only in the database, but a json file as well).

MacPorts

sudo port install bash util-linux jq

brew

brew install bash
brew install gnu-getopt
brew install jq

jnrmor - remove orphaned resources in Joplin

usage: jnrmor [-c CONFIGFILE] [-f] [-q|--quiet] [-n|--dry-run] [-d|--debug] [-V|--version] [-h] [--help]

       -c CONFIGFILE
           use CONFIGFILE, instead of searching the default locations
           The first file found is used.

       -f
           run without confirmation

       -q, --quiet
           do not print informational messages
           (errors will be shown)

       -n, --dry-run
           only show orphaned resources (do not actually delete them)
           implies -f

       -d, --debug
           print debug information

       -V, --version
           version information

       -h
           usage information

       --help
           this help

If you rather use a perl script, head over here. You can use the script listnotes.pl with the option --weed.

jnclnst - clean sync target (remove orphaned resources from sync target)

This script is no longer needed. A fix was added to Joplin a while back. It’s only here for reference and for people who still use an old Joplin version. It doesn’t hurt to run the script, it just won’t find anything to remove anything anymore.

usage: jnclnst [-c CONFIGFILE] [-f] [-q|--quiet] [-n|--dry-run] [-d|--debug] [-V|--version] [-h] [--help]

       -c CONFIGFILE
           use CONFIGFILE, instead of searching the default locations
           The first file found is used.

       -f
           run without confirmation

       -q, --quiet
           do not print informational messages
           (errors will be shown)

       -n, --dry-run
           only show orphaned resources (do not actually delete them)
           implies -f

       -d, --debug
           print debug information

       -V, --version
           version information

       -h
           usage information

       --help
           this help

joplin-scripts's People

Contributors

tessus avatar tomhense avatar woosting avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joplin-scripts's Issues

Suggest adding "joplin" tag

I've just noticed that several Joplin-related projects have added the "joplin" tag to their repo, which makes it easier to find them. If you think that's a good idea I suggest adding it to this repo too.

disabled note history prevents deletion?

the script respects note history settings by default with this check

KEEP=`sqlite3 $DB "select value from settings where key = 'revisionService.ttlDays'"`
if [ -z "$KEEP" ]; then

However when I disabled note history, and execute the SQL statement in sqlite, it returns empty result, but the script goes into the next line anyway, thus I need to wait for 90 days to delete "just orphaned" resources

I used zsh by the way, does -z behave the same in both shells?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.