How Best 301 Redirect in Drupal 7? How can I best redirect the following in Drupal 7?

stuff/bookA.pdf
stuff/bookB.pdf
stuff/magA.pdf
stuff/magB.pdf
stuff/...
stuff/magn.pdf


to

books/booka.pdf
books/bookb.pdf
mags/maga.pdf
mags/magb.pdf
mags/...
mags/magn.pdf


There are only a few Books (which can be redirected individually). There are hundreds of Mags.


I cannot find a module which does this. 
I could write a custom module which checks the URL and redirects along these lines. 
I am lost writing redirects in .htaccess. 


Is there a noticeable performance improvement using .htaccess over the module solution?

If using .htaccess what would the rules be?
If you directly edit .htaccess (at the root directory of Drupal), I suppose you may as well be very careful, because any update of Drupal may delete it.  For that reason, as I understand it is not recommended in general.

I have been using Redirect module for that purpose and am content with it.
With the module, you can manually set the redirection for each path in its configuration panel.  But as you have hundreds of paths, perhaps you want a programmatical way.
An article by Dale McGladdery is concise and helpful for how to do that, using the module (It uses the Migration module; in your case ignore that part and set "From" and "To" URLs to suit your requirements).  Basically, you use redirect_save($redirect) function, where $redirect is the stdClass object, definining the paths and type of redirection. 

A potential trouble in his example is, if the same redirection exists, it raises an error.  Therefore if you ever rerun the process to set up the redirections, you will have a trouble.  To overwrite the existing redirection, you need to appropriately set rid of the object to pass to the funciton redirect_save().
I have done that in my migration, and you can have a look at the source code at GitHub (complete() section), if you want to have a look at an example.