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 (1)

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 )

1