Manual:Pywikibot/category.py

Scripts to manage categories.

Syntax: python category.py [global-arguments] action [-option]

where action can be one of these: * add   - mass-add a category to a list of pages * remove - remove category tag from all pages in a category * move  - move all pages in a category to another category * tidy  - tidy up a category by moving its articles into subcategories * tree  - show a tree of subcategories of a given category

and option can be one of these: * person - sort persons by their last name (for action 'add') * rebuild - reset the database

For the actions tidy and tree, the bot will store the category structure locally in category.dump. This saves time and server load, but if it uses these data later, they may be outdated; use the -rebuild parameter in this case.

For example, to create a new category from a list of persons, type: "category.py" 610L, 25644C                                   1,1           Top

If you want to add a category to an existing one you could do the following: category.py move

You will be prompted for the old category (that you also want to keep but enter it) OldCategoryname

Enter the name of the category without the 'Category:' prefix.

You will now be prompted for the new category, now enter the old and new Category like this: NewCategoryName