Board Thread:Support Requests - Getting Technical/@comment-4738647-20131129225241/@comment-188432-20131130020603

There are probably several approaches to this, but if they're already in a given category, then you could either:
 * delete the whole category
 * add another category (like category:delete) to the files within the category of deletion, and then go back and delete everything cat:delete

I'm not entirely sure of your needs, so let's run through the couple of possibilities I've outlined above. If you've already got the files in a category, and you want to delete everything in the category, then your job is pretty easy. Just type: python delete.py -cat:catname -pt:1 -summary:"Explain why you're deleting" It'll delete everything in the category with the name "catname". (Obviously, you change catname to your actual category name of interest.)

If you don't have everything gathered up into a neat little deletion category, then you'll need to have two-stage approach:
 * 1) Add a deletion category to your desired files. So first you throw the trash away by adding a category.  Let's call it, but you can really call it whatever you want. python add_text.py -text:"" -cat:"whatever category you need to look in to find the files" -pt:1
 * 2) Then you actually take the trash to the street by using delete.py: python delete.py -cat:"delete me" -pt:1 -summary:"Explain why you're deleting"

You may have to run step #1 semi-automatically if your category has pages from a variety of namespaces. In other words, don't answer "a for always" if prompted. Instead, manually say "y for yes" or "n for no" for every page you encounter in the category.

Personally, I'd choose a semi-automatic route for your first couple of runs like this. However, if you've got a huge category that's got hundreds of pages in say namespace:0 and hundreds of files, and hundreds of, I dunno, talk pages, then you'll want to go fully automatic.

To only add to only the files in a category, do this: python add_text.py -text:"" -cat:"wherever we're looking" -ns:6 -pt:1 -summary:"Deletion rationale"

You might be asking yourself why we need the step of adding the text first, and then using delete.py. Why can't we just specify ns:6 from delete.py?

The reason is that delete.py simply doesn't include that code. It is, of necessity, a two-step process. Also, delete.py — despite what it says in the documentation — does not actually allow a choice of whether you want to delete or not. Once you set it on a category, it deletes everything automatically, and you can stop it only with a hard ctrl-c interrupt.

So think of the add_text.py step as putting the files in the trashcan, and the delete.py as the "are you sure you want to delete these files?" step.