Forum: Poser 12


Subject: useless models

zander opened this issue on Jan 13, 2021 ยท 14 posts


structure posted Thu, 14 January 2021 at 8:26 PM Forum Coordinator

Use a script to run through your file to search for file references,

from there look at the folder names and determine if they contain anything you need,

if not, delete them

from __future__ import print_function 
import os
import os.path

class _dialogs:
    def get_folder( self, start = "" ):
        style = ( wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON )
        dialog = wx.DirDialog( None, 'Select a Folder ', start , style )
        return dialog.GetPath() if dialog.ShowModal() == wx.ID_OK else False

ignore_exts = ( ".png", ".xmp", ".obj" )
searchfolder = _dialogs().get_folder()  
list_of_files = os.listdir( searchfolder )
for file in list_of_files:
    file = os.path.join( searchfolder, file )
    print( file )
    if not file.endswith( ignore_exts ):
        try:
            with open( file, "r" ) as lines:
                for line in lines:
                    if "runtime" in line.lower(): 
                        print( line )
        except:
            continue

**This does not take into account compressed files

Locked Out