Jump to content

Uploadmultiple.py

From Meta, a Wikimedia project coordination wiki

Uploadmultiple.py is a Pywikipediabot python script to upload multiple images to a Mediawiki wiki.

This script is not included in the framework yet and it needs work. Get the script here: Uploadmultiple.py

Copy and paste the script into a text editor, then save the script in the pywikipediabot folder as Uploadmultiple.py.

Use at your own risk.

Usage

[edit]
python [Global-arguments] [-debug] [-file:xxx] [-nodesc] [-rename]


Arguments

[edit]
-debug Switch to debug mode. Files are not actually uploaded.
-file:xxx Specify the file which contains the list of filenames to be uploaded.
-nodesc Do not ask for a description for each file.
-rename Prompt for a new filename for each file in the filelist.

Description

[edit]

This bot uploads multiple files found in a list of files in a text document called "uploadlist.txt".

Create a text document called uploadlist.txt in your pywikipediabot folder.

Each file name should be in quotation marks and comma separated with no line breaks. The full image location needs to be listed.

For example:

"file1.jpg","file2.jpg","c:\docs\wiki\something.jpg"

Create and save this file then run the script.

Renaming files

[edit]

It is recommended that you rename your files to the desired destination names BEFORE running this script, for two reasons:

  1. this script won't ask you for the new filename unless you specify the -rename argument,
  2. since you can't see the image you're about to upload, it is difficult to know which file is which if they're all called IMG_0023, etc.

Creating the list of files

[edit]

You can create a list of the files in a folder a couple of ways.

With DOS

Using the DOS "dir" command:

dir /w > uploadlist.txt
With PowerShell

PowerShell respects non-ASCII-characters and is shipped with Windows since ages.

Get-ChildItem -File -name > uploadlist.txt

This creates a list of filenames named uploadlist.txt.

Next, open that file with a text editor. Use find-and-replaces to trim the list down to just a list of filenames, each in quotation marks and comma separated, as shown above.

If there are extra files in the directory which you don't want uploaded then be sure to edit them out of the file at this time.

With Vista and XP

Global options

[edit]

See also

[edit]