zim-wiki team mailing list archive
Mailing list archive
Re: howto strip metadata header
On Fri, Mar 2, 2012 at 3:47 PM, Adam Porter <adam@xxxxxxxxxxxxx> wrote:
> This will process a directory tree and remove the first 4 lines of
> each file. I did a quick test on a copy of my tree, but please make
> sure to back up your data first, and if it blows up, it's your fault.
You might want to use the HeadersDict class from zim.config. The read()
method actually parses the lines and only strips lines that are actually
headers. Much safer, because it will not change files that did not have
headers in the first place.
I would also recommend the File object from zim.fs as it does all kind of
checking for safe reading / writing on the files. But that is for the more