python get file folder location and file with glob
<p>hello im doing a search in my views for .opt.php files that are compiled.</p>

<p>currently im doing something like this</p>

<pre><code>for x in glob.glob(PATH_VIEWS + '*.opt.php'):

    # Get file names
    segment1 = x.split('/')
    filename = segment1[-1]
    realname = filename.split('.opt.php')
    appfolder = segment1[-4]
    folder = segment1[-2]

    ''' ../../../views/users/index.opt.php
    ['..', '..', '..', 'views', 'users', 'index.opt.php']
    index.opt.php
    ['index', ''] 
    '''
</code></pre>

<p>is there a better way to do this? i would like to get</p>

<p>filename like <code>index.opt.php</code> and the folders that the files are in in this example is in <code>../../../views/users</code> users</p>
