Manual:Pywikibot/movepages.py

From MediaWiki.org
Jump to: navigation, search
Bug blank.svg
Git repository of Wikimedia has this file:

The movepages.py script is used to move pages.

Commands[edit | edit source]

Command Meaning
-from and -to The page to move from and the page to move to.
-noredirect Leave no redirect behind.
-prefix Move pages by adding a namespace prefix to the names of the pages. (Will remove the old namespace prefix if any). Argument can also be given as "-prefix:namespace:".
-always Don't prompt to make changes, just do them.
-skipredirects Skip redirect pages (Warning: increases server load)
-summary Prompt for a custom summary, bypassing the predefined message texts. Argument can also be given as "-summary:XYZ".
-pairs Read pairs of file names from a file. The file must be in a format:
[[frompage]]
[[topage]]
[[frompage]]
[[topage]]

Argument can also be given as "-pairs:filename"

Example[edit | edit source]

  1. Copy the list of the current pages, for example with Special:PrefixIndex.
  2. Convert it in ASCII, for instance with this JavaScript tool.
  3. Paste it in the first column of a spreadsheet (eg: OpenOffice Calc).
  4. Create the second column with the same number of lines, with some characters which won't be present neither in the old pages names nor in the new (eg: [string to replace after by \n]).
  5. Paste your new pages names (converted in ASCII) into the third column.
  6. Copy the three columns into a file (eg: called "articles_pairs.txt").
  7. Search and replace with your text editor (eg: Notepad++), the second column content by the carriage return (\n).
  8. Launching: python movepages.py -lang:fr -family:wikibooks -pairs:"articles_pairs.txt" -noredirect will produce the wanted result.