ZBrushCentral

Creating a folder (directory) via ZScript?

Hello, I was wondering if it was possible to create a folder via ZScript at all.

I’ve got a script that does batch processing of OBJ files, and it’s meant to dump the results out to a new folder - the problem is that the folder it’s trying to write out into may not exist yet.
It’s a valid path, if the folder existed, but I don’t want the user to have to manually create the folder, since that somewhat defeats the purpose of automating it!

I found a page referring to the ZScript FileUtils DLL, but the link to download it is broken (just redirects to the ZBrush homepage, where I can’t find any reference to this DLL), and there’s no indication of whether this was ever kept up-to-date with later ZBrush releases.

There’s nothing I can find in the ZScript Command Reference that allows folder creation, and there doesn’t even seem to be a way to call a command prompt to md the folder via DOS.

Does anyone know of a way to automatically create a folder via ZScript?
I’m beginning to think I’m going to have to start calling Windows DLLs (since by searching these forums it seems like that should be possible…)

Thanks,
-MoP

You’d need to do this using a dll. I’ll see if I can update the ZFileUtils tomorrow.

Awesome, thanks Marcus.

I also just discovered that the [FileExists] command doesn’t seem to work for folders? You appear to have to pass a file extension to it, which means you can’t actually check if a folder exists or not :frowning:

I’m guessing I should be able to use the “GetDirFileList” command from ZFileUtils to be able to determine if the folder exists or not? Basically just by doing a GetDirFileList one level up (or ideally if that command returns false if you pass it a folder that doesn’t exist).

I guess in the worst case, I can just always force it to create the folder even if it already exists, hopefully that won’t break anything :slight_smile:

I’ll add in a check to see if the folder exists.

Can you PM me an email address? I’ll send you a beta version of the new ZFileUtils DLL to test out.