Tuesday, January 8, 2013

Importing trac wiki pages to confluence


Today I would like to talk you about Universal Wiki Converter (UWC). With the help of this tool and executing some commands you can easily import all the wiki content you wrote on trac to confluence. You can follow the steps below:


Download UWC.
https://plugins.atlassian.com/plugused ins/com.atlassian.uwc

Activate Xml RPC on confluence.

See Administration -> General Configuration -> Remote API (XML-RPC & SOAP)

Export wiki pages to your hard drive.


wget http://mytrac.mydomain.com/trac/myproject/login --save-cookies=cookies --keep-session-cookies --user=alex --ask-password

wget http://mytrac.mydomain.comtrac/myproject/wiki/tipoespais --load-cookies=cookies --save-cookies=cookies.new --keep-session-cookies -r -l 4 -I /trac/myproject/wiki/

In the url you must specify one of the pages.  

Delete all files except txt

ls |grep -v "format=txt" | xargs rm

Delete the tail on filename.

rename ?format=txt ""

Unzip the UCW and execute the tool.

unzip  uwc-4.0.zip

cd uwc

chmod +x *.sh

./run_uwc.sh


Select type "trac" and add all files you have exported.




Also, you may specify your confluence connection paramenters (url, login,password, and the spacekey where you want to import the pages).





2 comments:

  1. Many thanks for the post :) This is really very helpful and I've used it many times already.

    Btw, for a downloading the contents directly you can simply use:

    wget http://trac.example.com/trac//wiki/anypage --keep-session-cookies --user=username --ask-password -r -l 4 -I /trac/wiki/includepage

    ReplyDelete
  2. Hi Sujan, thanks for your comment. I'll try it. Sorry the delay answering.

    ReplyDelete