Deleting all default wiki pages in Trac

03.04.2007 at 20:00

I am currently evaluating Trac as a web management tool for a school project. By default Trac comes with lots of standard wiki content, mostly help instructions, which i don't need. So here is a simple script which saves the current wiki content and then deletes all pages.

cd /path/to/your/trac/project
mkdir wiki-exported && trac-admin . wiki dump wiki-exported
for page in $(trac-admin . wiki list | awk '{  if($1 ~ /^(Trac|Wiki).*$/) print $1}'); do 
    $(trac-admin . wiki remove $page); 
done

If you want to restore your wiki content then run

trac-admin . wiki load wiki-exported

To upgrade to the latest help instruction issue the following command

trac-admin . wiki upgrade

Marc

Comments (4)

if you're on windows

15.04.2011 by Dmitriy Pichugin

if you are using windows, create a batch script named delete_wiki.bat with text below and run it in environment directory for /f "skip=3 tokens=1" %%I in ('trac-admin . wiki list') do ( trac-admin . wiki remove %%I )

nice...

16.11.2013 by Dennis

Super Helpful! I appreciate you taking the time to post this. I was dreading having to go through and delete every page in the vast default wiki.

thanks

20.01.2014 by roiji

thanks for this. though, I should have ran this right after installation and not on an installation with pages :D

thanks

20.01.2014 by roiji

*because I was using the WikiStart page :D

1