Skip to content Skip to sidebar Skip to footer

Finding Folders Back Based On A Predefined Folder Structure

We've a dynamic folder structure syntax set up like: :projectRoot:/dev/model/:parentHierarchy:/:assetName:/data/obj :projectRoot:/dev/model/:parentHierarchy:/:assetName:/data/fbx :

Solution 1:

I think you can do it all with one regex:

In [24]: re.search(r'(.+)(?:dev/model/|asset/shots/)(.+)/(.+?)(?:/data|/scenes)', path).groups()
Out[24]: ('C:/Projects/foo/', 'props/furniture', 'couch')

Post a Comment for "Finding Folders Back Based On A Predefined Folder Structure"