[Closed] Create a new folder?
Id like to create script that does a similar thing to create new project in maya
but im not sure if you can create folders on your drive from within maxscript.
Ive sifted through the help doc but i couldnt see it mentioned anywhere.
Is it possible?
ahh ok very simple thanks
Is it possible to check if a folder exists? i know you can use getFiles() to check if a file exists but is there similar for folders?
Another problem im having is creating a 2 folder structure at the same time using makeDir.
I mean if im pulling a string from an editext set to say “folder1\folder2”
and setting to to my makeDir ie. makeDir “c:\folder1\folder2”
makeDir will not create the folder1 and then folder 2 within folder 1.
So do i have to create these folders separetly via 2 makeDir() ? Which means id need some way to seach the edittext string for the “” character and assign the before and after to variables in order to create the folder separetly.
would this be the way to approach this problem or is there a simplier method?
hope this makes sense
yes:
getDirectories wild_card_directory_name_string
however, if you try to create a directory that already exists you will NOT get an error.
here’s a function I wrote that does just that. it takes a path string and creates the entire tree for this path:
-- creates a dir structure (the entire specified path)
fn createDirStructure dir =
(
local a = filterString dir "\\/"
local str = ""
for i in a do
(
str += i + "\\"
makeDir str
)
str
)
hOpe this helps,
o