TJMcK writes

Currently if Recoll finds a file, and I would like to delete that file (from the Recoll database and from my hard drive), there in no direct way to do this (that I know of). The way I delete the file is to open the right-click menu and choose "open directory", but when deleting a lot of files, this is time-consuming (and it doesn’t always make an immediate change to Recolls database).

My suggestion would be to add this capability to the results line, so, for me I would have the following in the first line of recoll results: Preview Open Delete 85% SampleSentanceData… And the "delete file" option would also show in the right-click menu

BTW, Recoll is the best Linux indexer!! I’ve been using it as my primary indexer, for the better part of 10 years… everything’s perfect except for this "delete file" option that I’ve hoped to see for a long time.

medoc writes

Hi,

I think that adding a specific function for deleting a file would suit an excessively narrow purpose, but also that allowing users to run some arbitrary action on recoll results is a good idea. So here is what I did, in an update I just pushed to the source directory (this should become part of 1.20):

If there is a "scripts" subdirectory inside the config dir (~/.recoll/), the GUI will look for .desktop files inside, and create a "Run Script" submenu inside the right-click one.

Choosing one of the entries in the sub-menu runs the corresponding script (duh).

Here is how a desktop file could look like (e.g. myscript1.desktop):

#!shell

[Desktop Entry]
Type=Application
Name=My first script
Exec=/home/dockes/bin/tryscript %F
MimeType=*/*

The MimeType and Type values are not useful, but they must be present, and Type must be Application, else the file will be skipped.

And here follows the very interesting content of the "tryscript" script:

#!shell
#!/bin/sh

zenity --info --text=$*

A "Remove" script could contain "rm" and "recollindex -e " commands to remove the file and erase it from the index.

I’d suggest either asking for confirmation (e.g. with zenity), or using a "move to trash" command like https://code.google.com/p/rmv/ (which I did not test), rather than a raw rm, except if you have really good backups.

You may notice by the way how I very cleverly avoided taking responsibility for deleting files from recoll …

Please let me know what you think if you can give it a try.

medoc writes

I just added code so that the same scripts can be called by clicking a link in the list. Link format:

#!html

<a href="R%N|cmdname" >your text</a >

Where "cmdname" should match the "Name" field in the desktop entry.