Hi I have some code which works nine times out of ten. Maybe some could help me make this a little more robust. I have a bunch of files in a folder with a strict versioning based naming convention, where I want to open the highest version number of a nuke script (not necessarily the one with the newest modification date). So in the example folder contents listed below I want to open &quot;233_bb0072_comp_comp2k_v05.nk&quot; (fourth from the bottom). Every once in a while my python script ends up opening 233_bb0072_comp_comp2k_v04.nk (the next to last correct one). The script I am using is shown below. Can anyone explain why it doesn&#39;t always work?<br>

<br><br>233_bb0072_comp_comp2k_v01.nk<br>233_bb0072_comp_comp2k_v01.nk~<br>233_bb0072_comp_comp2k_v02.nk<br>233_bb0072_comp_comp2k_v03.nk<br>233_bb0072_comp_comp2k_v03.nk~<br>233_bb0072_comp_comp2k_v04.nk<br>233_bb0072_comp_comp2k_v04.nk~<br>

233_bb0072_comp_comp2k_v05.nk<br>233_bb0072_comp_comp2k_v05.autosave<br>233_bb0072_comp_comp2k_v05.nk~<br>233_bb0072_comp_comp2k_v06.nk<br><br>#######################################<br>import os<br>def openNewestCompCommandLine():<br>

<br>    theDirectory = &quot;/path/to/my/comps/&quot;<br>    theFilesInTheFolder = os.listdir(theDirectory)<br>    for aFile in theFilesInTheFolder:<br>        if &quot;~&quot; not in aFile:<br>            if &quot;autosave&quot; not in aFile:<br>

                theNukeFileName = aFile<br>    <br>    theFullPath = theDirectory + theNukeFileName<br>    os.system(&quot;nuke &quot;  + theFullPath)<br>if __name__ == &#39;__main__&#39;:<br>    openNewestCompCommandLine()<br>

<br>for aFile in theFilesInTheFolder:<br>    print aFile<br>################################################<br>Pete<br><br><br>