Mastodon Mastodon - Create ODT files using ZIP
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Create ODT files using ZIP

Create ODT files using ZIP

Posted on October 14, 2023  (Last modified on July 2, 2024) • 1 min read • 128 words
Snippet   Solved  
Snippet   Solved  
Share via

So I wanted to test something, for which I needed to create or modify an ODT file. Since ODT files are just ZIPs, I thought “open, edit, zip, done” would be sufficient.

It’s not:

  • you need to create the ODT file using a special procedure.
  • you may not include extra files into the ODT file (e.g. no “notes.txt” or sth)

The 2nd thing you have to take care of yourself, for the first I wrote a small Mac automator script, using bin/bash as shell:

SAVE_DIR="$PWD"

while read input_dir ; do
    [[ -d "$input_dir" ]] || continue

    cd "$input_dir"
    touch _odt_create_log.txt
    exec > _odt_create_log.txt
    exec 2>&1

    set -x
    ODT_FILE="../$(basename "$input_dir").odt"
    rm -f "$ODT_FILE"
    zip      "$ODT_FILE" -0 mimetype
    zip -ruo "$ODT_FILE"    .         -x mimetype _odt_create_log.txt
    cd "$SAVE_DIR"
    set +x
done
 Hetzner dedicated server setup
Hugo: index vs. _index 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Link copied to clipboard
Code copied to clipboard