Mass change of the document author
Tell me what to do)
Background:
У друга на работе уволился админ и на компе, буха, юрика
и самого директора, изменил пользователя на Х%Й Булыжников или Пися
Камушкин - не суть)
Но обнаружили это через неделю или две, когда открыли документы doc,
odt,xsl и прочие офисные, нажали файл - Свойства и там увидели сие
чудо) а файлы они эти куда-то шлют и там через эту процедуру, даты
сверяют в случае чего,)
How can such office files be transferred en masse (change or remove the author)?)
It takes a long time (to create a new dock, throw everything into it and save it - there are hundreds of documents there) of course, now the User is normal, but some documents were left with the Easter egg)))
Tell me how you can change it automatically under linux or windows.
I think that the script is possible, but I do not understand how to work with the api or LibreOffice itself from the console
Thanks...
P.S. as it turned out-the admin was very offended... and then they realized that they were wrong, but it was too late)
Convert to another format, in the hope of changing the author just as pointlessly
libreoffice -env:UserInstallation=file:///home/firefedot/.config/libreoffice-alt --headless --convert-to odt *.doc
As a result, the same author of the document creation and the same authors of the changes remained.
2 answers
Thanks @Qwertiy for the hint.
In general, so far, I have found such an option. First, we convert all the necessary files to the odt type, so
libreoffice -env:UserInstallation=file:///home/firefedot/.config/libreoffice-alt --headless --convert-to odt *.doc
Then you can use a script, or you can use your hands to do this. Unpack our ODT file to the folder
unzip file.odt -d folder
After that, we search for and replace the necessary / unnecessary author
grep NONAMES meta.xml --color
# Или если не знаем имени, то
grep creator meta.xml --color
And we will see what we need, it will be highlighted)
Replace everything you need
sed -i 's/NONAMES/MyName/g' meta.xml
Then, we give the final steps. We pack everything back, in two steps, for the correct structure of the new file
1:
cd folder
zip -0 -X file.odt mimetype
2:
zip -r file.odt * -x mimetype
After that, the file opens without an error, and if you open the File-Properties menu, we will see the author that you entered.
It remains to check how it all works with file names containing spaces.
P.S. if @Qwertiy objects, I can pass it all to him in response.
An Odt file is a zip archive. It is necessary to unpack it as a zip archive, find where the user name is located there, change it and pack it back. Similar with docx (but not doc).
PS: Did this with vsdx.