On Wed, Nov 7, 2012 at 9:02 AM, Jaap Karssenberg <jaap.karssenb...@gmail.com
> wrote:

> On Wed, Nov 7, 2012 at 6:13 AM, <hans...@gmail.com> wrote:
>
>> If I have a file attachment link embedded in a page (done via drag and
>> drop, relative links) and I'm then moving pages around in the hierarchy,
>> shouldn't the linked file be moved to the corresponding location along with
>> the page.
>>
>
> This works as long as the attachment is below the page, or outside the
> notebook. If it is relative to another level in the notebook, the current
> behavior is broken.
>
>
>> I've just discovered I've got hundreds of broken links scattered through
>> thousands of pages. 8-(
>>
>> Is there a way to check for and flag these even if I then have to fix
>> them manually?
>>
>
> Could do with a script to go over all the pages and find broken links. If
> file names are unique, fixing them automatically is not difficult either.
>

Attached a quick try for a script fixing links to attachments. Will print
out all broken file links, can fix automatically if a single match is found
on file name.

Usage is: python find_broken_links.py /path/to/notebook True|False

Where the "True" or "False" is for switching between a dry run and the real
fix. "True" means dry run, so nothing will be updated, only printed what
can be done. "False" means pages will be modified.

PLEASE make a backup of the whole notebook before running this.

If it works for you, I could integrate it as a tool in the GUI.

Regards,

Jaap

Attachment: find_broken_links.py
Description: Binary data

_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to