I imagine everyone has their own spin on it (ours is done using some 
higher-level classes, for example). However, this should get you there:


import errno
import os

def createOutputDirs():
    write = nuke.thisNode()
    base = os.path.dirname(nuke.filename(write))
    if '%V' in base or '%v' in base:
        # This will work fine as long as none of
        # your script view names contain spaces.
        views = write['views'].value().split()
        dirs = (base.replace('%V', v).replace('%v', v[0]) for v in views)
    else:
        dirs = [base]
    for d in dirs:
        try:
            os.makedirs(d)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise


-Nathan



From: Ron Ganbar 
Sent: Thursday, May 16, 2013 3:15 PM
To: Nuke user discussion 
Subject: [Nuke-users] Write Dirs

Hi, 
anyone knows of a good script that I can use to automatically create the 
directories for my Write node, that includes %V?
Can't easily find it on Nukepedia.


Thanks,
Ron Ganbar
email: [email protected]
tel: +44 (0)7968 007 309 [UK]
     +972 (0)54 255 9765 [Israel]
url: http://ronganbar.wordpress.com/


--------------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to