Ask Your Question

How do I delete macro(s) from several hundred .odt documents (some are converted .doc documents)? [closed]

asked 2014-04-15 23:55:17 +0200

scooter gravatar image

updated 2015-09-08 20:54:16 +0200

Alex Kemp gravatar image

LO ver Writer English Win7

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 20:15:29.464116

2 Answers

Sort by » oldest newest most voted

answered 2014-04-16 08:52:34 +0200

mahfiaz gravatar image

updated 2014-04-16 09:01:43 +0200

If you are a fan of python, then the following script will rename your files to oldname-new.ods and strip Basic directory from the file, which gets rid of the scripts. It will however not check if you actually do use the scripts, so you better have a backup of the original files until you are sure all the files work correctly. To run it type to command line C:\Python2.7\python.exe *.ods when in correct directory. Also you would have to install python :)


import glob, os, sys, zipfile

for pattern in sys.argv[1:]:
    for filepath in glob.glob(pattern):
        dirname, basename = os.path.split(filepath)
        root, ext = os.path.splitext(basename)
        newname = '%s-new%s' % (root, ext)
        outpath = os.path.join(dirname, newname)
        zin = zipfile.ZipFile (filepath, 'r')
        zout = zipfile.ZipFile (outpath, 'w')
        for item in zin.infolist():
            if item.filename == 'mimetype':
        for item in zin.infolist():
            if item.filename != 'mimetype' and item.filename[:6] != 'Basic/':

Credits for being helpful to and

edit flag offensive delete link more


Oh, and if using *.ods should create a too long command line, then put it inside quotes, "*.ods", then glob will take care of it.

mahfiaz gravatar imagemahfiaz ( 2014-04-16 08:55:30 +0200 )edit

Question Tools

1 follower


Asked: 2014-04-15 23:55:17 +0200

Seen: 310 times

Last updated: Apr 16 '14