Deleting a folder within a folder using two variables
<p>I've got multiple branches in the company folder and then multiple users per branch. I need to remove certain users as they leave a branch. I don't get an error but the entire branch folder gets deleted and not just the specified user folder. Can someone point me in the right direction</p>

<pre><code>#!/usr/bin/python
import os, sys, getopt, shutil
branch, user = "",""

if __name__ == "__main__":
    argv = sys.argv[1:]
    try:
       opts, args = getopt.getopt(argv, 'hd:e', ['help', 'branch=', 'user='])
    except getopt.GetoptError:
       print __doc__
       sys.exit()

    for opt, arg in opts:
       if opt in ('-h', '--help'):
           print __doc__
           sys.exit()
       if opt in ('-d', '--branch'):
           branch = arg
       if opt in ('-e', '--user'):
           user = arg

shutil.rmtree("/home/company/%s/%s" % (branch , user))
</code></pre>
