UploadFiles User Guide - Aspallar/WikiTools GitHub Wiki

UploadFiles

UploadFiles is a windows command line utility that can be used to bulk upload image files to a FANDOM (aka Wikia) wiki site. It might work on other MediaWiki sites but it is unlikely, it will probably fail to log on.

Usage

UploadFiles [<switches>] [<filepattern>]

Examples

Upload all .png files in folder c:\data\myimages\ to mywiki.

UploadFiles --site http://mywiki.wikia.com c:\data\myimages\*.png

Upload new version of foobar.jpg to default site, with no image page content.

UploadFiles --nocontent --force foobar.jpg

Switches

--site

Specifies the wiki site to upload to This can be omitted if a default site has been configured (see configuration below).

Example: UploadFiles --site http://mywonderwiki.wikia.com ...

--comment

Species the comment (summary) to use for the upload log. Enclose the comment in quotes if it contains any spaces.

Example: UploadFiles --comment "New foobar images" ...

--content

Specifies a file that contains the wikitext content to place in the image page for new images. It will not overwrite the image page for existing images even if the --force switch is specified. If omitted the content will default to the content, if any, in the configuration file (see below).

Example: UploadFiles --content folder\mycontent.txt ...

--nocontent

Don't use the configured default content. No content will be used for the image pages.

Example: UploadFiles --nocontent ...

--category

Category to add to each upload. Note this will only be added if the image is new, it will not be added if you are uploading a new revision of an existing image using the --force switch.

Note that you can also add categories by using the --content switch, and placing [[Category: My Category]] tags at the bottom of the content file. You will need to use this method if you want to specify more than one category.

Example: UploadFiles --category "My Category" ...

--list

This is an alternative way to specify which files to load. Instead of specifying a file pattern use this to specify the name of a file containing a list of the files to upload one per line.

Example: UploadFiles --list imagelist.txt ...

--fails

Unless the --force switch is used images already on the wiki will not be uploaded. This switch specifies a file that a list of files that were not uploaded will be written to. This list can then be used as input to the --list switch.

Example: UploadFiles --fails uploadfails.txt ...

--force

Always upload even if the file already exists or is a duplicate. You need to use this if you want to upload a new revision of an existing file.

Example: UploadFiles --force ...

--user

Username to use for login. You will be prompted for this if omitted. Note that only confirmed users will be able to login.

Example: UploadFiles --user foobar ...

--password

Password to use for login. (you will be prompted for this if omitted)

Example: UploadFiles --password barfoo ...

--wait-files

In order to not trash the wiki when uploading a large number of files the uploader will wait for a time every nth file. This specifies how many files to upload before waiting. You can disable waiting by specifying 0 for this switch.

Example: UploadFiles --wait-files 10 ...

--wait-time

Number of seconds to wait after every --wait-files are uploaded.

Example: UploadFiles --wait-time 120 ...

--help

Display help. If specified then all other switches and parameters will be ignored.

--version

Display version information.

Configuration

You can configure some defaults by editing the UploadFiles.exe.config file that is in the application folder. Only change the settings in the <applicationSettings> section, leave the rest alone. Change the values in the <value> tags to suit your needs.

Here is a sample config file

<applicationSettings>
    <UploadFiles.Properties.Settings>
        <setting name="DefaultSite" serializeAs="String">
            <value>http://mywikisite.wikia.com</value>
        </setting>
        <setting name="DefaultText" serializeAs="String">
            <value>== Summary ==\n== Licensing ==\n{{Fairuse}}</value>
        </setting>
        <setting name="WaitFiles" serializeAs="String">
            <value>3</value>
        </setting>
        <setting name="WaitTime" serializeAs="String">
            <value>10</value>
        </setting>
    </UploadFiles.Properties.Settings>
</applicationSettings>

DefaultSite

This is the site to upload to if you omit the --site switch

DefaultText

This is the content to use by default if when neither the --content or --nocontent switches are specified. Use \n to start a new line.

WaitFiles

This is the default to use if --wait-files is not specified. Set to 0 to disable waiting, though read the note below first.

WaitTime

This is the default wait time (in seconds) to use if --wait-time is not specified.

A note on waiting

Why the wait time? Well it's there for two reasons

  1. As already mentioned if you are uploading a lot of files then this places some strain on the servers, a shared resource between your wiki and many others. Be nice don't trash the servers.
  2. When continuously uploading a lot of files there is a chance, albeit a small one, that some software layer will mistakenly identify your continuous uploads as part of a Denial of Service attack and block your IP address for a few hours.

Sample file for --content

=== Summary ===
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt lacus 
sit amet augue placerat, sit amet egestas est consequat. Sed massa diam, varius 
ac augue et, pulvinar mollis tortor. Maecenas lacinia at ipsum ut volutpat. 
Vivamus posuere maximus sapien, vel convallis eros bibendum et. Nam varius orci 
nec urna.
== License ==
{{{{CC-BY-SA}}
[[Category: Foobar image]]
[[Category: Another Category]]

Though it would probably be best to use a template for the summary above if more than a few images are being uploaded.

Using the --fail and --list switches together

Comming soon...

Format of --fail and --list files

Comming soon...

⚠️ **GitHub.com Fallback** ⚠️