Repair corrupted odt

Terrence Enger tenger at
Sun Nov 23 05:58:44 PST 2014

On Sun, 2014-11-23 at 12:01 +0100, Olivier Chorier wrote:
> Hello everybody,


I am afraid that this list is unlikely to give you the help you need.
I shall write my thoughts about your problem, but if you still have
difficulty, the forum at <> is a better
place for questions like yours.

It is important to tell us the systems involved, both the source and
the destination of the ftp transfer.  If one of your systems is OS/X,
my comments below apply in priciple, although the detailed form of the
damage is different.

> I'm looking for a way to repair thousands of corrupted odt files. Those
> files have been corrupted after FTP send operations, for some reason.

I would give long odds that you did the ftp transfer in ASCII mode;
this is the default, and it is really easy to forget to change the
transfer mode to BINARY.  The fact that transfers between Unix-derived
systems do not require the specification lets us get into the habit of

> The "zip" structure seems corrupted. I tried using 7-zip to unzip and zip
> again the odt file, but it doesn't work every time.

An ASCII-mode ftp transfer between a Windows-like system and a
Unix-like system converts line endings to match the conventions of the
respective systems.  A "zip" file does not actually consist of lines,
of course.  That is why we call the result "damage".

> Libre Office can repair them every time, but I need to open, repair, save
> and close those files one by one.

I am surprised that LibreOffice can do the repair.  I would have
guessed otherwise.  How sure are you that the result is correct?

If you are forced to recover files this way, let's think of
command-line foo to reduce the number of times you have to pay
attention to the process.

> I wonder if a script or something like that could be used to repair those
> files. I can't do it manually because there is thousand of them. Ideally, I
> could check them, and repair them automatically using a bash or a java
> script...

The most direct and most reliable way is to repeat the ftp transfer,
but precede the actual transfer with ftp command `binary`.  If this
solution is available to you, it is the best by a wide margin IMHO.

You might be able to recover by transferring the files back to the
original system in ASCII mode and then transferring them back to your
current system in BINARY mode.  The emphasis here is on "might": the
translation of line-endings may not be reversible.


> Thank you very much for your help,
> Olivier.

More information about the LibreOffice mailing list