I want to copy (not move) a few hundred pages from one namespace to another. Any ideas how?
I think I can do it in two stages - if I can create a page. I'd create each page with only the page name, then convert that to a transclusion from the mainspace article:
python replace.py -regex ".*" "{{subst:PAGENAME}}" -file:pagelist python replace.py -regex ".*" "{{subst::\1}}" -file:pagelist
But I get the error "Page [[blah blah]] not found" when I run the first command. I also tried with "" as the search string in the first line, but it's the same. And ideally I'd like it to exclude cases where the page already exists.
Any solution? Thanks!
This is another case where I'd use "pagefromfile.py". http://meta.wikimedia.org/wiki/Pywikipediabot/pagefromfile.py
Modify your pagelist so it has a format like
{{-start-}} '''Namespace:Pagename1''' {{subst::Pagename1}} <- note the double colon in case your articles are in the main namespace. {{-stop-}} {{-start-}} '''Namespace:Pagename2''' {{subst::Pagename2}} {{-stop-}} etc.
You can do that easily with some clever search-and-replace in the text editor of your choice.
Then call the bot with python pagefromfile.py -notitle -file:pagelist This also automatically excludes pages where the page already exist (in case you're not calling the script with a -force parameter).
Hope that helps! --zai
On Fri, Mar 26, 2010 at 7:04 AM, Chris Watkins <chriswaterguy@appropedia.org
wrote:
I want to copy (not move) a few hundred pages from one namespace to another. Any ideas how?
I think I can do it in two stages - if I can create a page. I'd create each page with only the page name, then convert that to a transclusion from the mainspace article:
python replace.py -regex ".*" "{{subst:PAGENAME}}" -file:pagelist python replace.py -regex ".*" "{{subst::\1}}" -file:pagelist
But I get the error "Page [[blah blah]] not found" when I run the first command. I also tried with "" as the search string in the first line, but it's the same. And ideally I'd like it to exclude cases where the page already exists.
Any solution? Thanks!
-- Chris Watkins
Appropedia.org - Sharing knowledge to build rich, sustainable lives.
blogs.appropedia.org community.livejournal.com/appropedia identi.ca/appropedia twitter.com/appropedia
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
I would suggest using Special:Export and Special:Import, and just changing <title>namespace: to <title>new namespace:. I'm not quite sure what happens with the id parameters thought; you might want to strip those.
-Merlijn
On 26 March 2010 07:04, Chris Watkins chriswaterguy@appropedia.org wrote:
I want to copy (not move) a few hundred pages from one namespace to another. Any ideas how?
I think I can do it in two stages - if I can create a page. I'd create each page with only the page name, then convert that to a transclusion from the mainspace article:
python replace.py -regex ".*" "{{subst:PAGENAME}}" -file:pagelist python replace.py -regex ".*" "{{subst::\1}}" -file:pagelist
But I get the error "Page [[blah blah]] not found" when I run the first command. I also tried with "" as the search string in the first line, but it's the same. And ideally I'd like it to exclude cases where the page already exists.
Any solution? Thanks!
-- Chris Watkins
Appropedia.org - Sharing knowledge to build rich, sustainable lives.
blogs.appropedia.org community.livejournal.com/appropedia identi.ca/appropedia twitter.com/appropedia
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l