• Update a lots of files with their history automatically

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #48030  by mamad
 
hi guys,
Consider the case i have a lots of files (1000 for example) and also have their history (other versions)
How can i upload all of these files with their history ?
I try import/export but it only imports one version of each file and wont add their history !
Is there any way to do this operation automatically (maybe with some scripts ) ??
 #48036  by saulhidalgo
 
Good afternoon.

Yes, It can be done automatically. I would suggest to do a custom script using the API that uploads the files checking if the document already exists, to upload the new version of it.

Please, take a look at the API Description section, in your case, you would be interested on the entry OKMDocument and maybe OKMDocumentService.

You can also contact me in case you need any advice or guide to do it.

Mail: saulhidalgoaular@gmail.com.
Skype: saulhidalgoaular@outlook.com
Phone: +58 426 517 94 59.

Best Regards.
Saul Hidalgo.
 #48052  by mamad
 
hi saulhidalgo
thanks for your reply
Does your approach works for cases we have a lots of versions for each document too?
Actually i have a lots of document which every one has a lots of versions.
 #48060  by jllort
 
Should use an script, upload the oldest file ( create ) and then modify ( checkout, checkin ) with the new versions:

https://docs.openkm.com/kcenter/view/ok ... eateSimple
https://docs.openkm.com/kcenter/view/ok ... l#checkout ( mark for edition )
https://docs.openkm.com/kcenter/view/ok ... ml#checkin ( update )

You can also use the SDK's for java for this kind of iterations or scripting ( crontab task ) from OpenKM side
https://docs.openkm.com/kcenter/view/ok ... pting.html
https://docs.openkm.com/kcenter/view/ok ... ontab.html
https://docs.openkm.com/kcenter/view/ok ... b-job.html
 #48144  by mamad
 
Instead of doing your solutions i found another way and upload all of my files with their histories correctly !
Now i will share my way for other guys who looking for a free way !!!
Its easy
consider your file is "myfile.pdf" and it has two version (1.0 and 2.0).Now export this file with history.If you look at the exported file you will see a structure like this :
myfile.pdf -> its a an empty file
myfile.pdf#v1.0# -> its the version 1.0 of file
myfile.pdf#v2.0# -> its the version 2.0 of file
If you create this structure for every file and Import it back to openkm you will have your file with its history !
So you need to write a simple script to create this structure. these are steps you have to do:
1- First of all you have to Export the whole or maybe a part of your current directory of openkm
Then for each file :
1- locate your files with their histories(other versions) in your directory of files(your hard disk or ...)
2- locate path of the file in the openkm foldering structure
3- create a empty file with the name of your file (for example myfile.pdf)
now for each version of your file :
1- copy that version of file to the directory you founded
2- reaname the file to proper format.for example for version 3.1 of "myfile.pdf",i have to rename it to : "myfile.pdf#v3.1#"
After coping all files to your openkm foldering structure,Import it back to openkm(dont forget to check History option)
This solution works for me 100% !!!
 #48150  by jllort
 
Yes, that should working if you reproduce the same way on how OpenKM exports history you get a way to import. I thought was easily done from code either building this structure, that's why I do not explain this option. Really with the repository export / import format ( based in json -> the okm files ) you can change all the values ( security, owner, metadata, dates ). There's a direct mapping between this format and what you get into the repository.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.