BSicon/Guide

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This page explains how to create and modify BSicons in bulk using Pywikibot, command line tools and other software.

If you have never used Pywikibot, no additional coding is required to use it to upload or rename files, but you will need to be comfortable with shell scripts. There is more information about using Pywikibot at the MediaWiki wiki, and other users should be able to help you on talk pages or on IRC.

Editing[edit]

The simplest (but not easiest) way to find BSicons is to use PetScan. An example query is petscan:5045737. To do a file name search you will need to know how to use regular expressions; otherwise you will need to search solely through categories. You can then download them with Imker; create a text file that contains the file names. (If you are not comfortable with regular expressions, download the PetScan results as CSV and manipulate the file in a spreadsheet editor like Microsoft Excel or LibreOffice Calc.)

You can use simple text editors like Notepad and TextEdit to write BSicons, but you may prefer to use a more complex text editor like BBEdit (macOS) or Notepad++ (Windows). It can handle regular expressions, which are fairly useful in editing multiple files and in uploading files with Pywikibot.

Command line tools can be used to duplicate BSicons and do simple find-and-replace searches and file renames. Instructions for the Unix command line (macOS/Linux) and the Swiss File Knife tool (Windows/macOS/Linux) are provided below. The SFK documentation is within its command line.

With Swiss File Knife for macOS, right-click on the .command files and then open when you first launch them to bypass the "you can't open this application" dialog box (or, alternatively use chmod u+x filename in the command line to make the files executable by you).

A script which can duplicate most non-mixed icons in the railway set into the 32 other standard sets is below. If you're using the SFK script, copy and paste it into the SFK command window; otherwise, copy and paste it into the system terminal. If you don't have a folder named BSicon/tmp in your home folder, change BSicon/tmp to a folder that exists (and BSicon/tmp2 to a folder that doesn't exist or is empty, as copies of the original folder will be duplicated into that folder).

Script for duplication into other sets (Linux command line)
rename 's/_/ /;' BSicon/tmp/*
mkdir BSicon/tmp2
cp -r BSicon/tmp/ BSicon/tmp2/u/
cp -r BSicon/tmp/ BSicon/tmp2/f/
cp -r BSicon/tmp/ BSicon/tmp2/g/
cp -r BSicon/tmp/ BSicon/tmp2/azure/
cp -r BSicon/tmp/ BSicon/tmp2/black/
cp -r BSicon/tmp/ BSicon/tmp2/blue/
cp -r BSicon/tmp/ BSicon/tmp2/brown/
cp -r BSicon/tmp/ BSicon/tmp2/carrot/
cp -r BSicon/tmp/ BSicon/tmp2/cerulean/
cp -r BSicon/tmp/ BSicon/tmp2/cyan/
cp -r BSicon/tmp/ BSicon/tmp2/deepsky/
cp -r BSicon/tmp/ BSicon/tmp2/denim/
cp -r BSicon/tmp/ BSicon/tmp2/fuchsia/
cp -r BSicon/tmp/ BSicon/tmp2/golden/
cp -r BSicon/tmp/ BSicon/tmp2/green/
cp -r BSicon/tmp/ BSicon/tmp2/grey/
cp -r BSicon/tmp/ BSicon/tmp2/jade/
cp -r BSicon/tmp/ BSicon/tmp2/lavender/
cp -r BSicon/tmp/ BSicon/tmp2/lime/
cp -r BSicon/tmp/ BSicon/tmp2/maroon/
cp -r BSicon/tmp/ BSicon/tmp2/ochre/
cp -r BSicon/tmp/ BSicon/tmp2/olive/
cp -r BSicon/tmp/ BSicon/tmp2/orange/
cp -r BSicon/tmp/ BSicon/tmp2/pink/
cp -r BSicon/tmp/ BSicon/tmp2/purple/
cp -r BSicon/tmp/ BSicon/tmp2/red/
cp -r BSicon/tmp/ BSicon/tmp2/ruby/
cp -r BSicon/tmp/ BSicon/tmp2/saffron/
cp -r BSicon/tmp/ BSicon/tmp2/sky/
cp -r BSicon/tmp/ BSicon/tmp2/steel/
cp -r BSicon/tmp/ BSicon/tmp2/teal/
cp -r BSicon/tmp/ BSicon/tmp2/violet/
cp -r BSicon/tmp/ BSicon/tmp2/yellow/

rename 's/BSicon /BSicon u/;' BSicon/tmp2/u/*
rename 's/BSicon /BSicon f/;' BSicon/tmp2/f/*
rename 's/BSicon /BSicon g/;' BSicon/tmp2/g/*
rename 's/\./ azure./;' BSicon/tmp2/azure/*
rename 's/\./ black./;' BSicon/tmp2/black/*
rename 's/\./ blue./;' BSicon/tmp2/blue/*
rename 's/\./ brown./;' BSicon/tmp2/brown/*
rename 's/\./ carrot./;' BSicon/tmp2/carrot/*
rename 's/\./ cerulean./;' BSicon/tmp2/cerulean/*
rename 's/\./ cyan./;' BSicon/tmp2/cyan/*
rename 's/\./ deepsky./;' BSicon/tmp2/deepsky/*
rename 's/\./ denim./;' BSicon/tmp2/denim/*
rename 's/\./ fuchsia./;' BSicon/tmp2/fuchsia/*
rename 's/\./ golden./;' BSicon/tmp2/golden/*
rename 's/\./ green./;' BSicon/tmp2/green/*
rename 's/\./ grey./;' BSicon/tmp2/grey/*
rename 's/\./ jade./;' BSicon/tmp2/jade/*
rename 's/\./ lavender./;' BSicon/tmp2/lavender/*
rename 's/\./ lime./;' BSicon/tmp2/lime/*
rename 's/\./ maroon./;' BSicon/tmp2/maroon/*
rename 's/\./ ochre./;' BSicon/tmp2/ochre/*
rename 's/\./ olive./;' BSicon/tmp2/olive/*
rename 's/\./ orange./;' BSicon/tmp2/orange/*
rename 's/\./ pink./;' BSicon/tmp2/pink/*
rename 's/\./ purple./;' BSicon/tmp2/purple/*
rename 's/\./ red./;' BSicon/tmp2/red/*
rename 's/\./ ruby./;' BSicon/tmp2/ruby/*
rename 's/\./ saffron./;' BSicon/tmp2/saffron/*
rename 's/\./ sky./;' BSicon/tmp2/sky/*
rename 's/\./ steel./;' BSicon/tmp2/steel/*
rename 's/\./ teal./;' BSicon/tmp2/teal/*
rename 's/\./ violet./;' BSicon/tmp2/violet/*
rename 's/\./ yellow./;' BSicon/tmp2/yellow/*

find BSicon/tmp2/u/ -type f -print0 | xargs -0 sed -i -e "s%<title>%<title>u%g;s%BE2D2C%003399%g;s%D77F7E%6281C0%g"
find BSicon/tmp2/f/ -type f -print0 | xargs -0 sed -i -e "s%<title>%<title>f%g;s%BE2D2C%008000%g;s%D77F7E%64B164%g"
find BSicon/tmp2/g/ -type f -print0 | xargs -0 sed -i -e "s%<title>%<title>g%g;s%BE2D2C%2CA05A%g;s%D77F7E%7EC49A%g"
find BSicon/tmp2/azure/ -type f -print0 | xargs -0 sed -i -e "s%</title>% azure</title>%g;s%BE2D2C%3399FF%g;s%D77F7E%99CCFF%g"
find BSicon/tmp2/black/ -type f -print0 | xargs -0 sed -i -e "s%</title>% black</title>%g;s%BE2D2C%000000%g;s%D77F7E%646464%g"
find BSicon/tmp2/blue/ -type f -print0 | xargs -0 sed -i -e "s%</title>% blue</title>%g;s%BE2D2C%0078BE%g;s%D77F7E%64ACD6%g"
find BSicon/tmp2/brown/ -type f -print0 | xargs -0 sed -i -e "s%</title>% brown</title>%g;s%BE2D2C%8D5B2D%g;s%D77F7E%B89A7F%g"
find BSicon/tmp2/carrot/ -type f -print0 | xargs -0 sed -i -e "s%</title>% carrot</title>%g;s%BE2D2C%ED9121%g;s%D77F7E%F1BA76%g"
find BSicon/tmp2/cerulean/ -type f -print0 | xargs -0 sed -i -e "s%</title>% cerulean</title>%g;s%BE2D2C%1A8BB9%g;s%D77F7E%73B7D3%g"
find BSicon/tmp2/cyan/ -type f -print0 | xargs -0 sed -i -e "s%</title>% cyan</title>%g;s%BE2D2C%40E0D0%g;s%D77F7E%8AEAE1%g"
find BSicon/tmp2/deepsky/ -type f -print0 | xargs -0 sed -i -e "s%</title>% deepsky</title>%g;s%BE2D2C%00BFFF%g;s%D77F7E%7FDFFF%g"
find BSicon/tmp2/denim/ -type f -print0 | xargs -0 sed -i -e "s%</title>% denim</title>%g;s%BE2D2C%00619F%g;s%D77F7E%649EC3%g"
find BSicon/tmp2/fuchsia/ -type f -print0 | xargs -0 sed -i -e "s%</title>% fuchsia</title>%g;s%BE2D2C%B5198D%g;s%D77F7E%D173B8%g"
find BSicon/tmp2/golden/ -type f -print0 | xargs -0 sed -i -e "s%</title>% golden</title>%g;s%BE2D2C%D7C447%g;s%D77F7E%E5DA8E%g"
find BSicon/tmp2/green/ -type f -print0 | xargs -0 sed -i -e "s%</title>% green</title>%g;s%BE2D2C%2DBE2C%g;s%D77F7E%7FD67E%g"
find BSicon/tmp2/grey/ -type f -print0 | xargs -0 sed -i -e "s%</title>% grey</title>%g;s%BE2D2C%999999%g;s%D77F7E%C0C0C0%g"
find BSicon/tmp2/jade/ -type f -print0 | xargs -0 sed -i -e "s%</title>% jade</title>%g;s%BE2D2C%53B147%g;s%D77F7E%95CE8E%g"
find BSicon/tmp2/lavender/ -type f -print0 | xargs -0 sed -i -e "s%</title>% lavender</title>%g;s%BE2D2C%9999FF%g;s%D77F7E%C0C0FF%g"
find BSicon/tmp2/lime/ -type f -print0 | xargs -0 sed -i -e "s%</title>% lime</title>%g;s%BE2D2C%99CC00%g;s%D77F7E%D1E681%g"
find BSicon/tmp2/maroon/ -type f -print0 | xargs -0 sed -i -e "s%</title>% maroon</title>%g;s%BE2D2C%800000%g;s%D77F7E%B16464%g"
find BSicon/tmp2/ochre/ -type f -print0 | xargs -0 sed -i -e "s%</title>% ochre</title>%g;s%BE2D2C%CC6600%g;s%D77F7E%DEA164%g"
find BSicon/tmp2/olive/ -type f -print0 | xargs -0 sed -i -e "s%</title>% olive</title>%g;s%BE2D2C%837902%g;s%D77F7E%B2AC64%g"
find BSicon/tmp2/orange/ -type f -print0 | xargs -0 sed -i -e "s%</title>% orange</title>%g;s%BE2D2C%FF6600%g;s%D77F7E%FF9955%g"
find BSicon/tmp2/pink/ -type f -print0 | xargs -0 sed -i -e "s%</title>% pink</title>%g;s%BE2D2C%F0668D%g;s%D77F7E%F4A1B8%g"
find BSicon/tmp2/purple/ -type f -print0 | xargs -0 sed -i -e "s%</title>% purple</title>%g;s%BE2D2C%8171AC%g;s%D77F7E%B1A8CB%g"
find BSicon/tmp2/red/ -type f -print0 | xargs -0 sed -i -e "s%</title>% red</title>%g;s%BE2D2C%EF161E%g;s%D77F7E%F37176%g"
find BSicon/tmp2/ruby/ -type f -print0 | xargs -0 sed -i -e "s%</title>% ruby</title>%g;s%BE2D2C%CC0066%g;s%D77F7E%DE64A1%g"
find BSicon/tmp2/saffron/ -type f -print0 | xargs -0 sed -i -e "s%</title>% saffron</title>%g;s%BE2D2C%FFAB2E%g;s%D77F7E%FFC969%g"
find BSicon/tmp2/sky/ -type f -print0 | xargs -0 sed -i -e "s%</title>% sky</title>%g;s%BE2D2C%069DD3%g;s%D77F7E%67C2E3%g"
find BSicon/tmp2/steel/ -type f -print0 | xargs -0 sed -i -e "s%</title>% steel</title>%g;s%BE2D2C%A1B3D4%g;s%D77F7E%C6D1E5%g"
find BSicon/tmp2/teal/ -type f -print0 | xargs -0 sed -i -e "s%</title>% teal</title>%g;s%BE2D2C%339999%g;s%D77F7E%82C0C0%g"
find BSicon/tmp2/violet/ -type f -print0 | xargs -0 sed -i -e "s%</title>% violet</title>%g;s%BE2D2C%800080%g;s%D77F7E%B164B1%g"
find BSicon/tmp2/yellow/ -type f -print0 | xargs -0 sed -i -e "s%</title>% yellow</title>%g;s%BE2D2C%FFD702%g;s%D77F7E%FFEB81%g"

find BSicon/tmp2/ -type f -print0 | xargs -0 perl -pi -e 'chomp if eof'
Script for duplication into other sets (macOS command line)
rename 's/_/ /;' BSicon/tmp/*
rm BSicon/tmp/.DS_Store
mkdir BSicon/tmp2
cp -r BSicon/tmp/ BSicon/tmp2/u/
cp -r BSicon/tmp/ BSicon/tmp2/f/
cp -r BSicon/tmp/ BSicon/tmp2/g/
cp -r BSicon/tmp/ BSicon/tmp2/azure/
cp -r BSicon/tmp/ BSicon/tmp2/black/
cp -r BSicon/tmp/ BSicon/tmp2/blue/
cp -r BSicon/tmp/ BSicon/tmp2/brown/
cp -r BSicon/tmp/ BSicon/tmp2/carrot/
cp -r BSicon/tmp/ BSicon/tmp2/cerulean/
cp -r BSicon/tmp/ BSicon/tmp2/cyan/
cp -r BSicon/tmp/ BSicon/tmp2/deepsky/
cp -r BSicon/tmp/ BSicon/tmp2/denim/
cp -r BSicon/tmp/ BSicon/tmp2/fuchsia/
cp -r BSicon/tmp/ BSicon/tmp2/golden/
cp -r BSicon/tmp/ BSicon/tmp2/green/
cp -r BSicon/tmp/ BSicon/tmp2/grey/
cp -r BSicon/tmp/ BSicon/tmp2/jade/
cp -r BSicon/tmp/ BSicon/tmp2/lavender/
cp -r BSicon/tmp/ BSicon/tmp2/lime/
cp -r BSicon/tmp/ BSicon/tmp2/maroon/
cp -r BSicon/tmp/ BSicon/tmp2/ochre/
cp -r BSicon/tmp/ BSicon/tmp2/olive/
cp -r BSicon/tmp/ BSicon/tmp2/orange/
cp -r BSicon/tmp/ BSicon/tmp2/pink/
cp -r BSicon/tmp/ BSicon/tmp2/purple/
cp -r BSicon/tmp/ BSicon/tmp2/red/
cp -r BSicon/tmp/ BSicon/tmp2/ruby/
cp -r BSicon/tmp/ BSicon/tmp2/saffron/
cp -r BSicon/tmp/ BSicon/tmp2/sky/
cp -r BSicon/tmp/ BSicon/tmp2/steel/
cp -r BSicon/tmp/ BSicon/tmp2/teal/
cp -r BSicon/tmp/ BSicon/tmp2/violet/
cp -r BSicon/tmp/ BSicon/tmp2/yellow/

rename 's/BSicon /BSicon u/;' BSicon/tmp2/u/*
rename 's/BSicon /BSicon f/;' BSicon/tmp2/f/*
rename 's/BSicon /BSicon g/;' BSicon/tmp2/g/*
rename 's/\./ azure./;' BSicon/tmp2/azure/*
rename 's/\./ black./;' BSicon/tmp2/black/*
rename 's/\./ blue./;' BSicon/tmp2/blue/*
rename 's/\./ brown./;' BSicon/tmp2/brown/*
rename 's/\./ carrot./;' BSicon/tmp2/carrot/*
rename 's/\./ cerulean./;' BSicon/tmp2/cerulean/*
rename 's/\./ cyan./;' BSicon/tmp2/cyan/*
rename 's/\./ deepsky./;' BSicon/tmp2/deepsky/*
rename 's/\./ denim./;' BSicon/tmp2/denim/*
rename 's/\./ fuchsia./;' BSicon/tmp2/fuchsia/*
rename 's/\./ golden./;' BSicon/tmp2/golden/*
rename 's/\./ green./;' BSicon/tmp2/green/*
rename 's/\./ grey./;' BSicon/tmp2/grey/*
rename 's/\./ jade./;' BSicon/tmp2/jade/*
rename 's/\./ lavender./;' BSicon/tmp2/lavender/*
rename 's/\./ lime./;' BSicon/tmp2/lime/*
rename 's/\./ maroon./;' BSicon/tmp2/maroon/*
rename 's/\./ ochre./;' BSicon/tmp2/ochre/*
rename 's/\./ olive./;' BSicon/tmp2/olive/*
rename 's/\./ orange./;' BSicon/tmp2/orange/*
rename 's/\./ pink./;' BSicon/tmp2/pink/*
rename 's/\./ purple./;' BSicon/tmp2/purple/*
rename 's/\./ red./;' BSicon/tmp2/red/*
rename 's/\./ ruby./;' BSicon/tmp2/ruby/*
rename 's/\./ saffron./;' BSicon/tmp2/saffron/*
rename 's/\./ sky./;' BSicon/tmp2/sky/*
rename 's/\./ steel./;' BSicon/tmp2/steel/*
rename 's/\./ teal./;' BSicon/tmp2/teal/*
rename 's/\./ violet./;' BSicon/tmp2/violet/*
rename 's/\./ yellow./;' BSicon/tmp2/yellow/*

find BSicon/tmp2/u/ -type f -print0 | xargs -0 sed -i "" -e "s%<title>%<title>u%g;s%BE2D2C%003399%g;s%D77F7E%6281C0%g"
find BSicon/tmp2/f/ -type f -print0 | xargs -0 sed -i "" -e "s%<title>%<title>f%g;s%BE2D2C%008000%g;s%D77F7E%64B164%g"
find BSicon/tmp2/g/ -type f -print0 | xargs -0 sed -i "" -e "s%<title>%<title>g%g;s%BE2D2C%2CA05A%g;s%D77F7E%7EC49A%g"
find BSicon/tmp2/azure/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% azure</title>%g;s%BE2D2C%3399FF%g;s%D77F7E%99CCFF%g"
find BSicon/tmp2/black/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% black</title>%g;s%BE2D2C%000000%g;s%D77F7E%646464%g"
find BSicon/tmp2/blue/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% blue</title>%g;s%BE2D2C%0078BE%g;s%D77F7E%64ACD6%g"
find BSicon/tmp2/brown/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% brown</title>%g;s%BE2D2C%8D5B2D%g;s%D77F7E%B89A7F%g"
find BSicon/tmp2/carrot/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% carrot</title>%g;s%BE2D2C%ED9121%g;s%D77F7E%F1BA76%g"
find BSicon/tmp2/cerulean/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% cerulean</title>%g;s%BE2D2C%1A8BB9%g;s%D77F7E%73B7D3%g"
find BSicon/tmp2/cyan/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% cyan</title>%g;s%BE2D2C%40E0D0%g;s%D77F7E%8AEAE1%g"
find BSicon/tmp2/deepsky/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% deepsky</title>%g;s%BE2D2C%00BFFF%g;s%D77F7E%7FDFFF%g"
find BSicon/tmp2/denim/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% denim</title>%g;s%BE2D2C%00619F%g;s%D77F7E%649EC3%g"
find BSicon/tmp2/fuchsia/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% fuchsia</title>%g;s%BE2D2C%B5198D%g;s%D77F7E%D173B8%g"
find BSicon/tmp2/golden/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% golden</title>%g;s%BE2D2C%D7C447%g;s%D77F7E%E5DA8E%g"
find BSicon/tmp2/green/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% green</title>%g;s%BE2D2C%2DBE2C%g;s%D77F7E%7FD67E%g"
find BSicon/tmp2/grey/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% grey</title>%g;s%BE2D2C%999999%g;s%D77F7E%C0C0C0%g"
find BSicon/tmp2/jade/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% jade</title>%g;s%BE2D2C%53B147%g;s%D77F7E%95CE8E%g"
find BSicon/tmp2/lavender/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% lavender</title>%g;s%BE2D2C%9999FF%g;s%D77F7E%C0C0FF%g"
find BSicon/tmp2/lime/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% lime</title>%g;s%BE2D2C%99CC00%g;s%D77F7E%D1E681%g"
find BSicon/tmp2/maroon/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% maroon</title>%g;s%BE2D2C%800000%g;s%D77F7E%B16464%g"
find BSicon/tmp2/ochre/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% ochre</title>%g;s%BE2D2C%CC6600%g;s%D77F7E%DEA164%g"
find BSicon/tmp2/olive/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% olive</title>%g;s%BE2D2C%837902%g;s%D77F7E%B2AC64%g"
find BSicon/tmp2/orange/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% orange</title>%g;s%BE2D2C%FF6600%g;s%D77F7E%FF9955%g"
find BSicon/tmp2/pink/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% pink</title>%g;s%BE2D2C%F0668D%g;s%D77F7E%F4A1B8%g"
find BSicon/tmp2/purple/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% purple</title>%g;s%BE2D2C%8171AC%g;s%D77F7E%B1A8CB%g"
find BSicon/tmp2/red/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% red</title>%g;s%BE2D2C%EF161E%g;s%D77F7E%F37176%g"
find BSicon/tmp2/ruby/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% ruby</title>%g;s%BE2D2C%CC0066%g;s%D77F7E%DE64A1%g"
find BSicon/tmp2/saffron/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% saffron</title>%g;s%BE2D2C%FFAB2E%g;s%D77F7E%FFC969%g"
find BSicon/tmp2/sky/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% sky</title>%g;s%BE2D2C%069DD3%g;s%D77F7E%67C2E3%g"
find BSicon/tmp2/steel/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% steel</title>%g;s%BE2D2C%A1B3D4%g;s%D77F7E%C6D1E5%g"
find BSicon/tmp2/teal/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% teal</title>%g;s%BE2D2C%339999%g;s%D77F7E%82C0C0%g"
find BSicon/tmp2/violet/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% violet</title>%g;s%BE2D2C%800080%g;s%D77F7E%B164B1%g"
find BSicon/tmp2/yellow/ -type f -print0 | xargs -0 sed -i "" -e "s%</title>% yellow</title>%g;s%BE2D2C%FFD702%g;s%D77F7E%FFEB81%g"

find BSicon/tmp2/ -type f -print0 | xargs -0 perl -pi -e 'chomp if eof'
Script for duplication into other sets (Swiss File Knife)
sfk ren -pat '$_$ $' -dir "BSicon/tmp" -file .svg -yes
sfk copy BSicon/tmp BSicon/tmp2/u -yes
sfk copy BSicon/tmp BSicon/tmp2/f -yes
sfk copy BSicon/tmp BSicon/tmp2/g -yes
sfk copy BSicon/tmp BSicon/tmp2/azure -yes
sfk copy BSicon/tmp BSicon/tmp2/black -yes
sfk copy BSicon/tmp BSicon/tmp2/blue -yes
sfk copy BSicon/tmp BSicon/tmp2/brown -yes
sfk copy BSicon/tmp BSicon/tmp2/carrot -yes
sfk copy BSicon/tmp BSicon/tmp2/cerulean -yes
sfk copy BSicon/tmp BSicon/tmp2/cyan -yes
sfk copy BSicon/tmp BSicon/tmp2/deepsky -yes
sfk copy BSicon/tmp BSicon/tmp2/denim -yes
sfk copy BSicon/tmp BSicon/tmp2/fuchsia -yes
sfk copy BSicon/tmp BSicon/tmp2/golden -yes
sfk copy BSicon/tmp BSicon/tmp2/green -yes
sfk copy BSicon/tmp BSicon/tmp2/grey -yes
sfk copy BSicon/tmp BSicon/tmp2/jade -yes
sfk copy BSicon/tmp BSicon/tmp2/lavender -yes
sfk copy BSicon/tmp BSicon/tmp2/lime -yes
sfk copy BSicon/tmp BSicon/tmp2/maroon -yes
sfk copy BSicon/tmp BSicon/tmp2/ochre -yes
sfk copy BSicon/tmp BSicon/tmp2/olive -yes
sfk copy BSicon/tmp BSicon/tmp2/orange -yes
sfk copy BSicon/tmp BSicon/tmp2/pink -yes
sfk copy BSicon/tmp BSicon/tmp2/purple -yes
sfk copy BSicon/tmp BSicon/tmp2/red -yes
sfk copy BSicon/tmp BSicon/tmp2/ruby -yes
sfk copy BSicon/tmp BSicon/tmp2/saffron -yes
sfk copy BSicon/tmp BSicon/tmp2/sky -yes
sfk copy BSicon/tmp BSicon/tmp2/steel -yes
sfk copy BSicon/tmp BSicon/tmp2/teal -yes
sfk copy BSicon/tmp BSicon/tmp2/violet -yes
sfk copy BSicon/tmp BSicon/tmp2/yellow -yes
sfk rep -pat '$<title>$<title>u$' -dir "BSicon/tmp2/u" -file .svg -yes
sfk ren -pat '$BSicon $BSicon u$' -dir "BSicon/tmp2/u" -file .svg -yes
sfk rep -pat '$BE2D2C$003399$' -dir "BSicon/tmp2/u" -file .svg -yes
sfk rep -pat '$D77F7E$6281C0$' -dir "BSicon/tmp2/u" -file .svg -yes
sfk rep -pat '$<title>$<title>f$' -dir "BSicon/tmp2/f" -file .svg -yes
sfk ren -pat '$BSicon $BSicon f$' -dir "BSicon/tmp2/f" -file .svg -yes
sfk rep -pat '$BE2D2C$008000$' -dir "BSicon/tmp2/f" -file .svg -yes
sfk rep -pat '$D77F7E$64B164$' -dir "BSicon/tmp2/f" -file .svg -yes
sfk rep -pat '$<title>$<title>g$' -dir "BSicon/tmp2/g" -file .svg -yes
sfk ren -pat '$BSicon $BSicon g$' -dir "BSicon/tmp2/g" -file .svg -yes
sfk rep -pat '$BE2D2C$2CA05A$' -dir "BSicon/tmp2/g" -file .svg -yes
sfk rep -pat '$D77F7E$7EC49A$' -dir "BSicon/tmp2/g" -file .svg -yes
sfk rep -pat '$</title>$ azure</title>$' -dir "BSicon/tmp2/azure" -file .svg -yes
sfk ren -pat '$.$ azure.$' -dir "BSicon/tmp2/azure" -file .svg -yes
sfk rep -pat '$BE2D2C$3399FF$' -dir "BSicon/tmp2/azure" -file .svg -yes
sfk rep -pat '$D77F7E$99CCFF$' -dir "BSicon/tmp2/azure" -file .svg -yes
sfk rep -pat '$</title>$ black</title>$' -dir "BSicon/tmp2/black" -file .svg -yes
sfk ren -pat '$.$ black.$' -dir "BSicon/tmp2/black" -file .svg -yes
sfk rep -pat '$BE2D2C$000000$' -dir "BSicon/tmp2/black" -file .svg -yes
sfk rep -pat '$D77F7E$646464$' -dir "BSicon/tmp2/black" -file .svg -yes
sfk rep -pat '$</title>$ blue</title>$' -dir "BSicon/tmp2/blue" -file .svg -yes
sfk ren -pat '$.$ blue.$' -dir "BSicon/tmp2/blue" -file .svg -yes
sfk rep -pat '$BE2D2C$0078BE$' -dir "BSicon/tmp2/blue" -file .svg -yes
sfk rep -pat '$D77F7E$64ACD6$' -dir "BSicon/tmp2/blue" -file .svg -yes
sfk rep -pat '$</title>$ brown</title>$' -dir "BSicon/tmp2/brown" -file .svg -yes
sfk ren -pat '$.$ brown.$' -dir "BSicon/tmp2/brown" -file .svg -yes
sfk rep -pat '$BE2D2C$8D5B2D$' -dir "BSicon/tmp2/brown" -file .svg -yes
sfk rep -pat '$D77F7E$B89A7F$' -dir "BSicon/tmp2/brown" -file .svg -yes
sfk rep -pat '$</title>$ carrot</title>$' -dir "BSicon/tmp2/carrot" -file .svg -yes
sfk ren -pat '$.$ carrot.$' -dir "BSicon/tmp2/carrot" -file .svg -yes
sfk rep -pat '$BE2D2C$ED9121$' -dir "BSicon/tmp2/carrot" -file .svg -yes
sfk rep -pat '$D77F7E$F1BA76$' -dir "BSicon/tmp2/carrot" -file .svg -yes
sfk rep -pat '$</title>$ cerulean</title>$' -dir "BSicon/tmp2/cerulean" -file .svg -yes
sfk ren -pat '$.$ cerulean.$' -dir "BSicon/tmp2/cerulean" -file .svg -yes
sfk rep -pat '$BE2D2C$1A8BB9$' -dir "BSicon/tmp2/cerulean" -file .svg -yes
sfk rep -pat '$D77F7E$73B7D3$' -dir "BSicon/tmp2/cerulean" -file .svg -yes
sfk rep -pat '$</title>$ cyan</title>$' -dir "BSicon/tmp2/cyan" -file .svg -yes
sfk ren -pat '$.$ cyan.$' -dir "BSicon/tmp2/cyan" -file .svg -yes
sfk rep -pat '$BE2D2C$40E0D0$' -dir "BSicon/tmp2/cyan" -file .svg -yes
sfk rep -pat '$D77F7E$8AEAE1$' -dir "BSicon/tmp2/cyan" -file .svg -yes
sfk rep -pat '$</title>$ deepsky</title>$' -dir "BSicon/tmp2/deepsky" -file .svg -yes
sfk ren -pat '$.$ deepsky.$' -dir "BSicon/tmp2/deepsky" -file .svg -yes
sfk rep -pat '$BE2D2C$00BFFF$' -dir "BSicon/tmp2/deepsky" -file .svg -yes
sfk rep -pat '$D77F7E$7FDFFF$' -dir "BSicon/tmp2/deepsky" -file .svg -yes
sfk rep -pat '$</title>$ denim</title>$' -dir "BSicon/tmp2/denim" -file .svg -yes
sfk ren -pat '$.$ denim.$' -dir "BSicon/tmp2/denim" -file .svg -yes
sfk rep -pat '$BE2D2C$00619F$' -dir "BSicon/tmp2/denim" -file .svg -yes
sfk rep -pat '$D77F7E$649EC3$' -dir "BSicon/tmp2/denim" -file .svg -yes
sfk rep -pat '$</title>$ fuchsia</title>$' -dir "BSicon/tmp2/fuchsia" -file .svg -yes
sfk ren -pat '$.$ fuchsia.$' -dir "BSicon/tmp2/fuchsia" -file .svg -yes
sfk rep -pat '$BE2D2C$B5198D$' -dir "BSicon/tmp2/fuchsia" -file .svg -yes
sfk rep -pat '$D77F7E$D173B8$' -dir "BSicon/tmp2/fuchsia" -file .svg -yes
sfk rep -pat '$</title>$ golden</title>$' -dir "BSicon/tmp2/golden" -file .svg -yes
sfk ren -pat '$.$ golden.$' -dir "BSicon/tmp2/golden" -file .svg -yes
sfk rep -pat '$BE2D2C$D7C447$' -dir "BSicon/tmp2/golden" -file .svg -yes
sfk rep -pat '$D77F7E$E5DA8E$' -dir "BSicon/tmp2/golden" -file .svg -yes
sfk rep -pat '$</title>$ green</title>$' -dir "BSicon/tmp2/green" -file .svg -yes
sfk ren -pat '$.$ green.$' -dir "BSicon/tmp2/green" -file .svg -yes
sfk rep -pat '$BE2D2C$2DBE2C$' -dir "BSicon/tmp2/green" -file .svg -yes
sfk rep -pat '$D77F7E$7FD67E$' -dir "BSicon/tmp2/green" -file .svg -yes
sfk rep -pat '$</title>$ grey</title>$' -dir "BSicon/tmp2/grey" -file .svg -yes
sfk ren -pat '$.$ grey.$' -dir "BSicon/tmp2/grey" -file .svg -yes
sfk rep -pat '$BE2D2C$999999$' -dir "BSicon/tmp2/grey" -file .svg -yes
sfk rep -pat '$D77F7E$C0C0C0$' -dir "BSicon/tmp2/grey" -file .svg -yes
sfk rep -pat '$</title>$ jade</title>$' -dir "BSicon/tmp2/jade" -file .svg -yes
sfk ren -pat '$.$ jade.$' -dir "BSicon/tmp2/jade" -file .svg -yes
sfk rep -pat '$BE2D2C$53B147$' -dir "BSicon/tmp2/jade" -file .svg -yes
sfk rep -pat '$D77F7E$95CE8E$' -dir "BSicon/tmp2/jade" -file .svg -yes
sfk rep -pat '$</title>$ lavender</title>$' -dir "BSicon/tmp2/lavender" -file .svg -yes
sfk ren -pat '$.$ lavender.$' -dir "BSicon/tmp2/lavender" -file .svg -yes
sfk rep -pat '$BE2D2C$9999FF$' -dir "BSicon/tmp2/lavender" -file .svg -yes
sfk rep -pat '$D77F7E$C0C0FF$' -dir "BSicon/tmp2/lavender" -file .svg -yes
sfk rep -pat '$</title>$ lime</title>$' -dir "BSicon/tmp2/lime" -file .svg -yes
sfk ren -pat '$.$ lime.$' -dir "BSicon/tmp2/lime" -file .svg -yes
sfk rep -pat '$BE2D2C$99CC00$' -dir "BSicon/tmp2/lime" -file .svg -yes
sfk rep -pat '$D77F7E$D1E681$' -dir "BSicon/tmp2/lime" -file .svg -yes
sfk rep -pat '$</title>$ maroon</title>$' -dir "BSicon/tmp2/maroon" -file .svg -yes
sfk ren -pat '$.$ maroon.$' -dir "BSicon/tmp2/maroon" -file .svg -yes
sfk rep -pat '$BE2D2C$800000$' -dir "BSicon/tmp2/maroon" -file .svg -yes
sfk rep -pat '$D77F7E$B16464$' -dir "BSicon/tmp2/maroon" -file .svg -yes
sfk rep -pat '$</title>$ ochre</title>$' -dir "BSicon/tmp2/ochre" -file .svg -yes
sfk ren -pat '$.$ ochre.$' -dir "BSicon/tmp2/ochre" -file .svg -yes
sfk rep -pat '$BE2D2C$CC6600$' -dir "BSicon/tmp2/ochre" -file .svg -yes
sfk rep -pat '$D77F7E$DEA164$' -dir "BSicon/tmp2/ochre" -file .svg -yes
sfk rep -pat '$</title>$ olive</title>$' -dir "BSicon/tmp2/olive" -file .svg -yes
sfk ren -pat '$.$ olive.$' -dir "BSicon/tmp2/olive" -file .svg -yes
sfk rep -pat '$BE2D2C$837902$' -dir "BSicon/tmp2/olive" -file .svg -yes
sfk rep -pat '$D77F7E$B2AC64$' -dir "BSicon/tmp2/olive" -file .svg -yes
sfk rep -pat '$</title>$ orange</title>$' -dir "BSicon/tmp2/orange" -file .svg -yes
sfk ren -pat '$.$ orange.$' -dir "BSicon/tmp2/orange" -file .svg -yes
sfk rep -pat '$BE2D2C$FF6600$' -dir "BSicon/tmp2/orange" -file .svg -yes
sfk rep -pat '$D77F7E$FF9955$' -dir "BSicon/tmp2/orange" -file .svg -yes
sfk rep -pat '$</title>$ pink</title>$' -dir "BSicon/tmp2/pink" -file .svg -yes
sfk ren -pat '$.$ pink.$' -dir "BSicon/tmp2/pink" -file .svg -yes
sfk rep -pat '$BE2D2C$F0668D$' -dir "BSicon/tmp2/pink" -file .svg -yes
sfk rep -pat '$D77F7E$F4A1B8$' -dir "BSicon/tmp2/pink" -file .svg -yes
sfk rep -pat '$</title>$ purple</title>$' -dir "BSicon/tmp2/purple" -file .svg -yes
sfk ren -pat '$.$ purple.$' -dir "BSicon/tmp2/purple" -file .svg -yes
sfk rep -pat '$BE2D2C$8171AC$' -dir "BSicon/tmp2/purple" -file .svg -yes
sfk rep -pat '$D77F7E$B1A8CB$' -dir "BSicon/tmp2/purple" -file .svg -yes
sfk rep -pat '$</title>$ red</title>$' -dir "BSicon/tmp2/red" -file .svg -yes
sfk ren -pat '$.$ red.$' -dir "BSicon/tmp2/red" -file .svg -yes
sfk rep -pat '$BE2D2C$EF161E$' -dir "BSicon/tmp2/red" -file .svg -yes
sfk rep -pat '$D77F7E$F37176$' -dir "BSicon/tmp2/red" -file .svg -yes
sfk rep -pat '$</title>$ ruby</title>$' -dir "BSicon/tmp2/ruby" -file .svg -yes
sfk ren -pat '$.$ ruby.$' -dir "BSicon/tmp2/ruby" -file .svg -yes
sfk rep -pat '$BE2D2C$CC0066$' -dir "BSicon/tmp2/ruby" -file .svg -yes
sfk rep -pat '$D77F7E$DE64A1$' -dir "BSicon/tmp2/ruby" -file .svg -yes
sfk rep -pat '$</title>$ saffron</title>$' -dir "BSicon/tmp2/saffron" -file .svg -yes
sfk ren -pat '$.$ saffron.$' -dir "BSicon/tmp2/saffron" -file .svg -yes
sfk rep -pat '$BE2D2C$FFAB2E$' -dir "BSicon/tmp2/saffron" -file .svg -yes
sfk rep -pat '$D77F7E$FFC969$' -dir "BSicon/tmp2/saffron" -file .svg -yes
sfk rep -pat '$</title>$ sky</title>$' -dir "BSicon/tmp2/sky" -file .svg -yes
sfk ren -pat '$.$ sky.$' -dir "BSicon/tmp2/sky" -file .svg -yes
sfk rep -pat '$BE2D2C$069DD3$' -dir "BSicon/tmp2/sky" -file .svg -yes
sfk rep -pat '$D77F7E$67C2E3$' -dir "BSicon/tmp2/sky" -file .svg -yes
sfk rep -pat '$</title>$ steel</title>$' -dir "BSicon/tmp2/steel" -file .svg -yes
sfk ren -pat '$.$ steel.$' -dir "BSicon/tmp2/steel" -file .svg -yes
sfk rep -pat '$BE2D2C$A1B3D4$' -dir "BSicon/tmp2/steel" -file .svg -yes
sfk rep -pat '$D77F7E$C6D1E5$' -dir "BSicon/tmp2/steel" -file .svg -yes
sfk rep -pat '$</title>$ teal</title>$' -dir "BSicon/tmp2/teal" -file .svg -yes
sfk ren -pat '$.$ teal.$' -dir "BSicon/tmp2/teal" -file .svg -yes
sfk rep -pat '$BE2D2C$339999$' -dir "BSicon/tmp2/teal" -file .svg -yes
sfk rep -pat '$D77F7E$82C0C0$' -dir "BSicon/tmp2/teal" -file .svg -yes
sfk rep -pat '$</title>$ violet</title>$' -dir "BSicon/tmp2/violet" -file .svg -yes
sfk ren -pat '$.$ violet.$' -dir "BSicon/tmp2/violet" -file .svg -yes
sfk rep -pat '$BE2D2C$800080$' -dir "BSicon/tmp2/violet" -file .svg -yes
sfk rep -pat '$D77F7E$B164B1$' -dir "BSicon/tmp2/violet" -file .svg -yes
sfk rep -pat '$</title>$ yellow</title>$' -dir "BSicon/tmp2/yellow" -file .svg -yes
sfk ren -pat '$.$ yellow.$' -dir "BSicon/tmp2/yellow" -file .svg -yes
sfk rep -pat '$BE2D2C$FFD702$' -dir "BSicon/tmp2/yellow" -file .svg -yes
sfk rep -pat '$D77F7E$FFEB81$' -dir "BSicon/tmp2/yellow" -file .svg -yes

With Inkscape or SVGO and a text editor, SFK or other command line programs like sed (Unix) can also be used to find and replace paths extracted from multiple files when flipping or rotating lots of icons.

  • Extract all paths from some group of files: search for ( d="[^"]+").
  • Format each line into a valid SVG path, paste them into a new SVG, and use Inkscape or SVGO to generate flipped or rotated paths without a transform attribute.
    • If you use Inkscape, draw a large box around the paths, with the centre of the box being in the centre of the icon. Ctrl+ Shift+X opens the path editor. Select all elements; flip with the toolbar buttons, or rotate by clicking again on the elements and then clicking and dragging one of the buttons at the corner of the selection while Ctrl is pressed.
  • Extract the paths from the new SVG source, again by searching for ( d="[^"]+").
  • Use your text editor to add line numbers to each set of paths. Use regex find-and-replace to turn each line into a command, and run the commands on a duplicate of the original folder.
    • Find: ^(\d+)(.+)$
    • Replace (1): sfk rep -pat '$\2$<temp \1>$' -dir "BSicon/replace" -file .svg -yes
    • Replace (2): sfk rep -pat '$<temp \1>$\2$' -dir "BSicon/replace" -file .svg -yes

There is also a way to copy files into other sets using Python 3; it is shown below.

Script for duplication into other sets (Python 3)
#! python3
#
#
# Other colors maker
# "OTHERCOLOR" and "REGCOLOR" are
# key words

import re
# #1 is reg, #2 is ex
colors = {
    '_ maroon':['800000', 'B16464'],
    '_ red':['EF161E', 'F37176'],
    '_ orange':['FF6600', 'FF9955'],
    '_ saffron':['FFAB2E', 'FFC969'],
    '_ yellow':['FFD702', 'FFEB81'],
    '_ golden':['D7C447', 'E5DA8E'],
    '_ olive':['837902', 'B2AC64'],
    '_ lime':['99CC00', 'D1E681'],
    '_ green':['2DBE2C', '7FD67E'],
    '_ jade':['53B147', '95CE8E'],
    '_ teal':['339999', '82C0C0'],
    '_ cyan':['40E0D0', '8AEAE1'],
    '_ deepsky':['00BFFF', '7FDFFF'],
    '_ azure':['3399FF', '99CCFF'],
    '_ sky':['069DD3', '67C2E3'],
    '_ cerulean':['1A8BB9', '73B7D3'],
    '_ blue':['0078BE', '64ACD6'],
    '_ denim':['00619F', '649EC3'],
    '_ lavender':['9999FF', 'C0C0FF'],
    '_ purple':['8171AC', 'B1A8CB'],
    '_ violet':['800080', 'B164B1'],
    '_ fuchsia':['B5198D', 'D173B8'],
    '_ ruby':['CC0066', 'DE64A1'],
    '_ pink':['F0668D', 'F4A1B8'],
    '_ carrot':['ED9121', 'F1BA76'],
    '_ ochre':['CC6600', 'DEA164'],
    '_ brown':['8D5B2D', 'B89A7F'],
    '_ steel':['A1B3D4', 'C6D1E5'],
    '_ grey':['999999', 'C0C0C0'],
    '_ black':['000000', '646464'],
    '_':['BE2D2C', 'D77F7F'],
    'u_':['003399', '6281C0'],
    'f_':['008000', '64B164'],
    'g_':['2CA05A', '7EC49A']
    }

while True:
    icontype = input('Icon type ')
    templfilename = 'templates/BSicon ' + icontype + '.svg'

    templfile = open(templfilename, 'r')
    template = templfile.read()
    templfile.close()
    print('Done loading template')

    for i in colors:
        for j in range(2):
            newfilename = 'output/BSicon ' + i.replace('_', ('ex' * j) + icontype) + '.svg'
            newsvg = re.sub('<title>.*</title>', '', template.replace('REGCOLOR', colors[i][j]).replace('OTHERCOLOR', colors[i][(j + 1) % 2])).replace('height="500">', 'height="500"> <title>' + i.replace('_', ('ex' * j) + icontype) + '</title>').replace('\n', '').replace('\r', '')
            newfile = open(newfilename, 'w')
            newfile.write(newsvg)
            newfile.close()
        print('Done writing files "' + i.replace('_ ', '').replace('_', '') + '"')
    print('Done writing all files')
    if input('Quit? (y/n)').lower() in ['y', 'yes', 'true', 't']:
        break

To use: copy this script into a text file, and then save it like bsothercolors.py. Then run it either from the command line or from IDLE. Note: You must have Python 3 installed before running this script.

Templates are stored automatically in a folder in the main folder where you run it in from, automatically called "templates", and output is dumped into a folder called "output". You should set this up before using this script.

Templates can to be in the regular any set.

Uploads[edit]

If you are uploading more than 50 files, you will probably want to use Pywikibot. If you are using your own computer to upload files, Pywikibot can be installed according to the instructions on the MediaWiki wiki.

Uploads by API (i.e. with Pywikibot, for the purposes of this page) and using the legacy Special:Upload can generally use {{subst:BSicon file description}}, at least until Structured Commons comes along; the only template parameter |1= is to allow a category to be manually specified in Category:BSicon/… format (full page name). The advantage of using the API is that new files can be treated identically to old files, and the old file description does not have to be overwritten. This makes it easier to upload BSicons in particular with Pywikibot rather than with Commonist or with VicuñaUploader.

You may like to set the rate limits in the Pywikibot user-config.py file – minthrottle, maxthrottle, and put_throttle – to 0, or set minthrottle to a small value and the other two to 0 (otherwise there is basically no benefit to running it in parallel). If you name your files BSicon name.svg, they will be uploaded with that file name on Commons and you will not have to worry about it.

The -recursive command flag allows all files from a folder to be uploaded in one batch. However, it does not filter out hidden files automatically; a "y" key press asks the script to try to upload them anyway, resulting in an error which can be ignored. file.txt can be the usual upload template or {{subst:BSicon file description}}. /path/to/folder is the directory tree of the folder containing the BSicons.

cd core
python3 pwb.py upload.py -keep -noverify -ignorewarn -recursive -summary:"Uploaded file" -descfile:"/path/to/file.txt" /path/to/folder
Previous instructions, from before recursive uploading was added as a Pywikibot option

If you are a Mac or Linux user, you will need to use a .command or .sh file, and use the chmod function to make the file executable (e.g. chmod u+x /path/to/file/upload.command). You can also paste code into the terminal but this can be unreliable. If you're a Windows user, you will have to modify the below example for the Windows command line. You might like to figure out how PAWS works, although I'm not sure if it can actually upload files.

Sample Bash script (please modify it before usage)
  • "core" is the folder in which your pywikibot installation is located
  • "/path/to/files" is the complete directory path of your folder; e.g. "/Users/wikimediacommons/my BSicons"
  • To categorize a file manually, use {{subst:BSicon file description|Category:BSicon/category-name}}
  • You may like to replace "Uploaded file" with something more descriptive, especially if you are doing something that is easily described
  • The flags (e.g. -keep) are explained in the upload.py documentation; in short they confirm the file name, make the "Are you sure?"-style questions go away and add the edit summary
#!/bin/sh
cd core

python3 pwb.py upload.py -keep -noverify -ignorewarn -summary:"Uploaded file" "/path/to/files/BSicon BHF.svg" "{{subst:BSicon file description}}"
python3 pwb.py upload.py -keep -noverify -ignorewarn -summary:"Uploaded file" "/path/to/files/BSicon eBHF.svg" "{{subst:BSicon file description}}"
python3 pwb.py upload.py -keep -noverify -ignorewarn -summary:"Uploaded file" "/path/to/files/BSicon xBHF.svg" "{{subst:BSicon file description}}"
python3 pwb.py upload.py -keep -noverify -ignorewarn -summary:"Uploaded file" "/path/to/files/BSicon exBHF.svg" "{{subst:BSicon file description}}"

The best way to generate and edit such a file is probably to copy the file names (e.g. by selecting the files and pressing  Cmd+C on a Mac), paste them into your text editor, and modify the titles with a regular expression which matches them.

Afterwards, you may also want to run pywikibot in parallel, either by running multiple sets of commands in different terminal windows, or by joining multiple commands with the & operator so that they run at the same time. However, you don't want to overwhelm your computer by doing hundreds of uploads at the same time.

Example regexes

Note that these examples use \1 instead of the usual $1 for the first match. BBEdit uses \1.

This regex converts file names into commands. Change /path/to/files to the actual directory path.

  • Find: ^(.+\.svg)$
  • Replace: python3 pwb.py upload.py -keep -noverify -ignorewarn -summary:"Uploaded file" "/path/to/files/\1" "{{subst:BSicon file description}}"

This regex joins two commands so that they run in parallel. You can repeat this operation multiple times.

  • Find: ^(python3 .+)\n(python3 .+)$
  • Replace: \1 \& \2

Categorization[edit]

Categorization can be handled by Module:BSicon's categorize function; if you can read basic Lua (manual for MediaWiki's installation) and are comfortable with its quaint variety of regular expressions, you may want to add more regular expressions and search patterns to allow more icons to be correctly categorized. Currently a lot of icons are recognized but you will probably run into some issues, which you will want to fix manually with VisualFileChange or a similar tool. You can test it by going to a file page and typing {{subst:#invoke:BSicon|categorize}} and seeing what happens. (This function is built into {{BSicon file description}}.) You can also test code in the sandbox.

Moving pages[edit]

For page movers only: using Pywikibot's movepages.py at the maximum speed that Commons allows (minthrottle = 7.5) is marginally faster than typing them all out manually using the file mover script; double redirects must be fixed separately and User:CommonsDelinker/commands/filemovers should be edited manually.