Manual:Pywikibot/nowcommons.py

Script to delete files that are also present on Wikimedia Commons.

Do not run this script on Wikimedia Commons itself. It works based on a given array of templates defined below.

Files are downloaded and compared. If the files match, it can be deleted on the source wiki. If multiple versions of the file exist, the script will not delete. If the SHA1 comparison is not equal, the script will not delete.

A sysop account on the local wiki is required if you want all features of this script to work properly.

Parameters
-always        run automatically, do not ask any questions. All files that qualify for deletion are deleted. Reduced screen output.

-replace       replace links if the files are equal and the file names differ

-replacealways replace links if the files are equal and the file names differ without asking for confirmation

-replaceloose  Do loose replacements. This will replace all occurrences of the name of the image (and not just explicit image                   syntax). This should work to catch all instances of the file, including where it is used as a template parameter or in galleries. However, it can also make more mistakes.

-replaceonly   Use this if you do not have a local sysop account, but do                    wish to replace links from the NowCommons template.

-hash          Use the hash to identify the images that are the same. It                   doesn't work always, so the bot opens two tabs to let to                    the user to check if the images are equal or not.

Example
 python pwb.py nowcommons -replaceonly -replaceloose -replacealways \ -replace -hash