Menu

maintain file link when changing file position in the directories tree

sfpcom
2017-01-14
2017-01-17
  • sfpcom

    sfpcom - 2017-01-14

    Help from the FP community and funs, i like to receive suggestions for which could be the best strategy for managing files considering the following need:
    START: we have file linked to a node of a FP map
    II STEP: need to move the file to another directory in the pc
    III STEP: the link to the file must change accordingly in order not to copy the new link to the same node.

    The approach of dview seemed to be acceptable, but currently dview doesn't operate in FP 1.5 and so on.
    Therefore I ask if anybody utilizes some other strategy to build the directories/files in order not to rebuild drastically all the links each time.

    I think that this TOOL/METHOD could be another really powerful characteristic of FP for increasing the users base.

    PS: i'm not a groovy programmer so cannot scripting

    Thankyou.

     
  • Alexandre

    Alexandre - 2017-01-16

    The way I see is through scripting: to provide some file that contains the 2 paths on the same line, the previous and the new one like this:

    oldpath1 newpath1
    oldpath2 newpath2
    ... ...

    Then a script would read that file and update the current map.

    If you want to update multiple maps it could be done in groovy or another scripting tool external to Freeplane, like a bash script for example if you use Linux.

    Alexandre

     
  • sfpcom

    sfpcom - 2017-01-16

    my problem is when I need to move a directory with many files linked to some maps...
    so acting one by one seems very time consuming.

    Maybeif i keep file names unique I may have a script looking for the file in the pc and changing the link...do you think it is possible?

    Sfpc

     
  • Alexandre

    Alexandre - 2017-01-17

    Hi sfpcom,

    The problem is the same with windows shortcuts, if you create a shortcut to a file then you move the file the shortcut will not work anymore. In these cases Ms Windows will start a search for file and may find and link to the wrong file.

    Do you move your files so much?

    If you move an entire folder for example where all the sub folders and files changes you can do a search and replace in freeplane on the link I think.

    Alexandre

     
  • sfpcom

    sfpcom - 2017-01-17

    The problem is that I move files not very often, but when I move them normally are more than hundreds.
    Actually I try not to do it, but my pc is actually very messy. And to remember I need to add to the maps some nodes with the link to the directories I used for that map, basically this is destroying the easy undestanding of the map... I was hoping that the dview even if beeing a little bit too constraining, it would helping me on this, but currently it is not working.

    Inany case I will try your last suggestion.

    Thankyou.
    Sfpc

     
  • Dimitry Polivaev

    About dview: please submit a bug report and describe what goes wrong.

    Regards, Dimitry

     
  • nnako

    nnako - 2017-01-17

    Hi folks,

    here are some of my thoughts concerning how to prevent links from breaking when maps live within dynamically changing environments. Please have a look at my feature request #2265. This feature could handle not only moving files linked from within a map / node but:

    • moving single files linked from within a map
    • moving external maps linked from within a map
    • exporting branches consisting of nodes linking files / nodes into separate maps
    • moving branches consisting of nodes linking files / nodes into other maps

    all without breaking involved links (or at least offering a straight forward way to solve and stabilize them). The trick could be to use a specific syntax when specifying links within maps:

    • <filename>.mm,
    • <filename>.mm#<nodeid> or
    • <filename>.<whatever>

    all without an absolute or relative path prefix. This could signalize a "dynamic" link which is to be resolved when Freeplane does not find the map / file within the current map's local folder. So, when it does not find the file, it checks for currently open maps (within the same Freeplane instance). When not successful, Freeplane could look maybe within its file history and finally open a dialog to prompt for a specific file location...

    Just an idea which I would like to implement myself but unfortunately haven't had the time to do it, yet.

    What do you think? Do you see any conflicts or would this maybe solve / reduce the current efforts?