Skip to main content

Move Files

import os,hou, shutil
selected = hou.selectedNodes()
for x in selected:
    file = x.parm("env_map").eval()
    filename = os.path.basename(file)
    destdir = os.path.join(hou.expandString("$HIP"), "assets")
    destpath = os.path.join(destdir, filename)
    if os.path.exists(file):
        if os.path.exists(destdir):
            pass
        else:
            os.makedirs(destdir)
                
        if os.path.exists(destpath):
            pass
        else:
            shutil.copy(file, destdir)
            dpath = os.path.join(os.path.join("$HIP", "assets"), filename)
            x.parm("env_map").set(dpath)
            
    else:
        pass