Menu

#279 Import happens too fast!

v1.0 (example)
open
nobody
None
7
2018-09-06
2017-11-30
No

If I save attachement from my (web) email to one of nixnote2 import folders, it is first written to disk with .crdownload -extension and then renamed to right one. So, if attacement is file.ext it is saved first to file.ext.crdownload and after that renamed to file.ext.

When saving to disk start, nixnote2 will first create document file.ext.crdownload with that partly saved file, try to delete it and then when file is ready nixnote2 creates second document with file.ext and finally manage to remove that file.

What would be solution? Maybe if user could configure extensions what are not imported? Or system would wait that files "modified time" is at least 10 seconds old before it is imported (and deleted).

Discussion

  • Robert Spiegel

    Robert Spiegel - 2018-09-01

    I did a quick workaround fix this in v2.1.0-beta3d - https://github.com/robert7/nixnote2/releases
    Currently the ignored extensions are not configurable, but for now all file with ".tmp" in file name are ignored.

    So you can create simple bash script could be used to copy files to import folder. Example:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    #!/bin/bash
    
    if [ ! -f "$1" ]; then echo 1st param needs to be existing file!; exit 1; fi
    if [ ! -d "$2" ]; then echo 2nd param needs to be existing directory!; exit 1; fi
    
    # copy file with ".tmp" file extension to targed directory
    cp $1 $2/$1.tmp
    
    # rename file to original name
    mv $2/$1.tmp $2/$1
    

    I could make the extensions configurable, if this is still issue for someone.

    more info also here: https://github.com/robert7/nixnote2/issues/14

     

    Last edit: Robert Spiegel 2018-09-01
  • Jussi Jaaskelainen

    Hi!

    Because problem is files saved with www browser, you cannot change extension of it (at least not easily)

    For quick working fix would be:

    1. Timer what check import directories every 10 seconds

    2. If new file found from import directory

    3. wait 5 seconds

    4. try to import, if file dont' exists, jump out. Other case is import.

    This would be working solution at every case.

    Thank you!

     
  • Robert Spiegel

    Robert Spiegel - 2018-09-06

    Ok there is also easier workaround solution without the "sh" script I proposed before.
    This works both with v2.0 and v2.1

    Just organize your workflow as follows:
    1, do the download to "Directory1" - e.g. ~/Downloads
    2, then setup "Import folders" to a subdirectory of it - Directory2 - e.g. ~/Downloads/nixnote
    3, then download your files...
    4, when finished, move all files from Directory1 to Directory2 - as "move" is "atomic" operation, the problem should nort occur. Eg. mark all files in ~/Downloads then Cut & paste to the "Import folder" ~/Downloads/nixnote
    Then important point is you must not do "Copy&Paste" but "Cut&Paste" (=move)..

     

Log in to post a comment.