Page 1 of 1

Community edition massive operations bypass trick

Posted: Fri Jul 26, 2013 8:30 am
by wgerven
Hello everybody,

Reading this post ( and being faced with the same problem, I thought up a trick how to do massive operations on files in the community edition (6.2.4). I posted it as a reply to given post, but thought to copy paste it into a new thread as perhaps many other users have the same problem. One does need some basic understanding of pyhton to do it though... The trick is as follows:
Suppose you have in your file system a folder with books in pdf, that you wish to add to OpenKM and massively add keywords and/or categories.
1) For a moment, don't upload them yet to OpenKM, but prepare the (if you haven't already) categories you wish to add to them in OpenKM. (You don't have to think about keywords yet.)
2) Create a seperate empty folder /temp in OpenKM.
3) Upload 1 random pdf document to /temp, to which you assign those categories you want to massive add to the pdf's in your local folder of books.
4) Go to administration/export tab. Chose here to export the folder /temp to some folder on your local hard disk, and select to also export "metadata".
5) Navigate to this folder, it should contain the random pdf and a file named like the pdf +.okm
6) Basically the trick is that you can copy the contents of this .okm file for every book, keeping in mind to change filenames in the content appropriately.
7) That's what you need a python script for to do that "massively". I.e., run trough the pdf filenames, create for them *.okm files, copy in those files the metadata of the random file you exported & make the right adjustments within this content.
8 ) Then after running such script, you can go to the administration/import tab, and upload the whole folder with books and metadata. Make sure here to tick "Metadata" and to upload the books to /temp. As you don't tick "Restore UUIDs" there will be no file corruption as the file UUIDs will be newly generated by OpenKM.
9) All uploaded files should now have the categories attached to them. Keywords can be done massively by including them in the python script, but didn't have to be considered before the python step as OpenKM doesn't need UUIDs for them.
I agree it's not so neet, but it saves a lot of mouseclicks!! :|

Best regards,

edit: Make also sure that the python script fetches the file size and put it in the *.okm file.