This Forum has been archived

Forums: Admin Central Index Technical Help Deleting Unused Images
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1779 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Is there any way to just do a swift delete of all unused images? AWB doesn't have an option for it, and I'm hopeless with Python, so I'm kinda stumped here. --~Mana~ (Talk) 01:44, January 20, 2013 (UTC)

Not without a bot, unfortunately. I'm not sure if AWB can generate a list of pages from Special:UnusedImages, but if not, I could probably run a bot to do it for you. kerri (w) 01:55, January 20, 2013 (UTC)
I've tried running the HTML Scraper through Special:UnusedFiles, but I don't get anything back. I have a bot account flagged, set-up and ready to go, but without the list of files to be deleted, I can't do anything. I've searched around the AWB manual, previous forum posts and lazily Googled it, but I haven't came to any conclusion on how to do it. I'm basically trying to remove all of this, with exceptions to the badge images. --~Mana~ (Talk) 01:59, January 20, 2013 (UTC)

Suggestion: here is a short snippet of JavaScript you can use to generate a raw text list of files from the Special:UnusedFiles page:

if (mediaWiki.config.get("wgPageName") === "Special:UnusedFiles") {
	$(function () {
		var str = "";
		$('.gallerytext > a').each(function () {
			str += decodeURIComponent(this.href.substring(this.href.indexOf("File"))) + "\n";
		var $textarea = $('<textarea style="width: 95%; height: 100px"></textarea>');

Copy/paste that code into your w:c:beyblade:User:~Mana~/wikia.js page and then visit w:c:beyblade:Special:UnusedFiles. It will create a textarea box above the gallery which lists all the filenames (but only the ones which currently appear on the page -- you will need to keep clicking "next" to keep finding more unused files). But that should allow you to generate a list of files to feed through AWB. Does that work for your purposes? 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 04:07 UTC, Sunday, 20 January 2013

That helps with the list side of things, yes. But I've now realised that AWB can only delete manually, meaning I need to delete each one in the list by clicking. Is there not a way I can do it automatically? --~Mana~ (Talk) 19:52, January 20, 2013 (UTC)
Nevermind, I managed to do a batch delete. Thanks!--~Mana~ (Talk) 20:10, January 20, 2013 (UTC)
Glad you got it worked out :)
P.S. For any future readers of this thread: the JS I posted here is now automatically included as part of my w:c:dev:ListFiles script, since I have added it as a feature to that. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 01:39 UTC, Wednesday, 30 January 2013