[pmwiki-users] Reorganising our PMWiki?
Peter & Melodye Bowers
pbowers at pobox.com
Tue Mar 25 00:21:47 CDT 2008
> > Is there an easy way of moving pages from one
> > group/category to another? Can we just rename the
> > files? eg GroupA.Page1 to GroupB.Page1
>
> There once was a recipe, which I didn't try myself, for
> renaming pages,
> which would also do all the links.
I believe the recipe you are referring to is Cookbook/RenamePage.
You can also rename multiple pages (including entire groups) using the
WikiSh command "mv GroupA.* GroupB". Note that links are *not* updated (as
they are with RenamePage), but you also have search/replace capability with
"sed -i 's/searchfor/replacewith/' pages" and so you could presumably fix
links generically in that manner.
A WikiSh script like this *might* do what you want (you would copy this into
the WikiSh control panel and modify it from there):
for page in GroupA.*
do
mv ${page} GroupB
set newpage = `echo {$page} | sed 's/GroupA/GroupB'`
sed -i 's/\[\[${page}(?=[\|\]])/${newpage}/' *.*
done
Or, more selectively on the search/replace (grep is a more efficient tool
for finding a regex):
for page in GroupA.*
do
mv ${page} GroupB
set newpage = `echo {$page} | sed 's/GroupA/GroupB'`
sed -i 's/\[\[${page}(?=[\|\]])/${newpage}/' (grep -l
'\[\[${page}(?=[\|\]])' *.*)
done
Note I haven't tested that at all so you might want to work with it on a
page or 2 (for page in GroupA.Page1 GroupB.Page2) and check the results
before applying it to the whole group...
Are there other forms of links that need to be searched for besides
[[GroupA.Page1]] and [[GroupA.Page1|Display text]]? Probably...
Note that mv loses all history in a page as it just moves the current text
of the page into the new page.
-Peter
More information about the pmwiki-users
mailing list