views:

81

answers:

3

I'm trying to do the following:

$OOOPYTHON DocumentConverter.py .odt .pdf

for all of the ODT files i have in a particular document and looking for the right syntax to convert all odts to pdfs.

Thanks! Jake

A: 
for file in `ls *.odt`
do
   DocumentConverter.py $file ${file%.odt}.pdf
done

or whatever the actual command syntax is

ghills
no need the ls . for file in *.odt
ghostdog74
great, so i did this:for file in `ls *.odt`do $OOOPYTHON DocumentConverter.py $file $file.pdfdonebut how do i get the input file "123.odt" not to convert to "123.odt.pdf" with the above code?
${file%.odt}.pdf
ghills
+1  A: 

You can use find, ex :

find /path/to/files/ -name '*.odt' -exec python /path/to/DocumentConverter.py '{}' '{}.pdf' \;
OneOfOne
THANKS! You guys all rock!
+3  A: 
for file in *.odt; do
    $OOOPYTHON DocumentConverter.py "$file" "${file%.odt}.pdf"
done
Laurence Gonsalves