Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to convert several thousand documents from LWP (Lotus Word Pro) to DOC. When the converting process gets to around 250 (To 229 in some cases, 248 in others, 245, etc.. It gets near 250) documents converted it just quits.

The terminal lines I am using to convert this are:

soffice --headless --convert-to doc --outdir /home/cyrex/work/biopsias/2007 *.lwp


libreoffice --headless --convert-to doc --outdir /home/cyrex/work/biopsias/2007 *.lwp

both work but only get to around 250. I have 60K documents to convert and doing them 200 at a time would take A LOT of time.

Converting them to ODT also has the same problem.

I have LibreOffice version 3.5

UPDATE: I have checked to see if the 229 file was the cause. I have also checked if the following or the previous file were the cause. Negative. I even deleted the previous 20 files before the 250 barrier and the 20 after it. Same problem. I also opened the 229 file, the 228 file and the 230 file with LibreOffice with no problem. It just fails randomly before the 250.

UPDATE2: Tried with another completely different group of files, this time, DOC. Again it gets up to less than ~250. Just in case it matters I have the following hardware:

CPU - Core i7 2600
MOBO: Intel DZ68DB
OS: Ubuntu 32 Bit

share|improve this question
99.9% the problem is not with *office BUT with LWP file number 229... – izx Aug 2 '12 at 16:59
@Luis Alvardo. Seems strange that it workings correctly upto that point. Makes me wonder of there is advanced functionality in the 229th LWP that cannot be converted. Have you tried to take out that specific document from the equation to see how far the conversion will go. OR if they are in chronilogic order maybe there was service pack release on a specific date that caused the original program to change. – stephenmyall Aug 2 '12 at 17:01
Yeah I checked that. But if that would be the problem then it would always fail on the same file.. I even removed the 20 files before the 250 limit and the 20 after it. It still gave the same error. – Luis Alvarado Aug 2 '12 at 17:01
^ he says he can get further than 229, it just randomly stops, am I right? btw, can't help you sorry – Dr_Bunsen Aug 2 '12 at 17:02
please install libreoffice-dbg and gdb and run: – Bjoern Michaelsen Aug 2 '12 at 17:10

please install libreoffice-dbg and gdb and run: gdb /usr/lib/libreoffice/program/soffice.bin then enter set args --headless --convert-to doc --outdir /home/cyrex/work/biopsias/2007 ${insert all files here}. speaking of which maybe you are just hitting the maximum command line length of linux? A ulimit -s BIGMUMBER might help some, but in the end you likely end up still at some limit. In which case you should use the UNO API from a script or even shutter write a small StarBasic program doing what you want.

Edit: You should probably get away with apt-get install unoconv which you can pass a connection string (-c) to use a running instance of LibreOffice. Thus: Start LibreOffice headless and accepting remote connections. Then use unoconv to remotely trigger LibreOffice to convert. Since you are reusing the same instance, you should have no delays in application startup when using xargs to throw ~200 documents at LibreOffice at a time.

share|improve this answer
up vote 2 down vote accepted

I did the following but will not mark it as an answer. This only solves doing the whole conversion. The problem still exists. It grabbed an idea from the answer by Bjoern Michaelsen (+1 to you friend).

I made a simple "convert" file with this in it:

for F in `find /home/cyrex/Desktop/mom/$1 -type f -name "*.lwp"`
soffice --headless --convert-to doc --outdir /home/cyrex/work/$2 $F

It just grabs 2 variables, the one where I am getting the documents from and the one where I am sending them to. Something like:

./convert inmuno/vph/2007-2009/2007 vph/2007

this would grab everything in /home/cyrex/Desktop/mom/inmuno/vph/2007-2009/2007, convert that to DOC and then send it to /home/cyrex/work/vph/2007.

Like I said, is a half baked answer, might help somebody else until a proper answer comes out using only the libreoffice/soffice command.

share|improve this answer
If you dont care about LibreOffice starting up again and again find /home/cyrex/Desktop/mom/ -type f -name "*.lwp"|xargs soffice --headless --convert-to doc --outdir /home/cyrex/work/ should do as xargs takes care of command line length. – Bjoern Michaelsen Aug 2 '12 at 19:37

Sounds like a use case for a bash script :)
I've used 'unoconv' because LO always returns true, even when an error occurs.

  • Download the linked file and name it ''
  • Make it executable chmod +x
  • Specify the file dir and the output format (see script instructions)
  • Run the script ./
  • done


PS: couldn't figure out how to insert the code directly (strange syntax...)

share|improve this answer
will test it this weekend friend. – Luis Alvarado Aug 3 '12 at 20:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.