Notifications
Clear all
[Closed] Create new directory in file path?
May 24, 2017 1:02 pm
Hi,
I’m trying to get a script to create a new folder using the output path as a base.
The script at the moment grabs the file path and output file name and creates a .txt file in the same dir as the image output was set:
getFileNamePath rendOutputFilename + getFileNameFile rendOutputFilename + ".txt"
How can I get the script to create a new folder in the set output folder and put the text file in that?
I’ve had a look at the makedir command, but not sure how it will fit into that maxscript string.
Thanks for any pointers.
1 Reply
May 24, 2017 1:02 pm
You can use something like this:
It will tell you if the path does not exist, and ask what you want to do.
directoryPath = getFileNamePath rendOutputFilename
if(doesfileexist directoryPath == false)then
(
if (queryBox ("Could not find the output folder, do you want to create it? - " + directoryPath)) then
(
if (makeDir directoryPath all:true)then
(
messagebox ("Created the directory: " + directoryPath)
)else
(
messagebox "Could not create output directory, aborting."
)
)
)