Fandom Developers Wiki
Advertisement

ListFiles is a site-wide and user script for file management. It provides a form for building URL's to query the MediaWiki API, as well as an extensive list of options for formatting the data after retrieval. Some things you can do with this script are:

  • alphabetically enumerate all files on a wiki
  • search for all files that have a certain prefix
  • get a list of files larger than 1 MB
  • generate new lists without reloading the page
  • save and reset your settings
  • sort files by name, uploader, timestamp, width, etc.
  • lists generated in raw text can be parsed and used with other applications such as bots

Some things you cannot do with this script are:

  • easily find all files uploaded recently (use the Special:NewFiles special page instead)
  • find all .png images on a wiki. The aimime parameter could be used to search for files by mime type... but unfortunately it's server-intensive and is disabled across Wikia.

Installation

Template:Script Install/ImportJS

Demo

A live demo of this script can be seen and used at w:c:terraria:Project:ListFiles.

See also, examples of the "raw text filenames" feature:

Usage

Once the ListFiles script is installed, you can visit Project:ListFiles on your wiki to see the script in action. It will also load on subpages in the User: namespace that have 'ListFiles' in the title, e.g. User:Username/ListFiles – this is designed to be useful for people who have the script in their global.js.

If you'd like to force this script to load on different page, simply edit whichever page you want and place the following wikitext there:

<div id="ListFiles-container">This page provides a form to query the MediaWiki API for images and requires JavaScript in order to function. See [[w:c:dev:ListFiles]] for more information.</div>

The id="ListFiles-container" is the important part. The ListFiles script will look for a container that has that id, so if you put such a container on any page, the script will run on that page.

Raw text list of filenames

A side feature of this script is that it provides a raw text list of filenames on the following special pages:

These raw text lists can be useful for someone with a bot or automation script. For example, if you wanted to delete unused images on your wiki, you could visit Special:UnusedFiles and copy the raw text list of files provided by this script, and then feed that input through the AjaxBatchDelete script to easily mass delete them.

Updates

02 January 2017
Dai ca superman⋅ added AjaxRC support for script
23 January 2014
ShutterBat started translation in spanish of code (raw filenames by the moment specially for advanced version of QuickTools)
7 February 2013
Mathmagician extended the "raw list of filenames" feature to Special:UncategorizedFiles, thanks to Revitalizer's note on the talk page.
2 February 2013
Mathmagician extended the "raw list of filenames" feature to the new Special:UnusedVideos page.
29 January 2013
Mathmagician added feature for raw list of filenames at Special:UnusedImages (helpful for people who want to do a batch delete to clean up unused files).
30 October 2012
Mathmagician added feature for raw list of filenames at Special:ListFiles (convenient way to get a list of all files uploaded by a single user).
22 October 2012
Mathmagician added an image preview feature when hovering over filename links in the results table.
25 September 2012
Mathmagician created.
Advertisement