I want to extract all data from my .csv file and put it inside a folder. Problem is everytime i run my code, it will generate different folder everytime because I use this line of code:
newDir = filepath||Substitute(MDYHMS(Today()), "/", "-", ":", ".");
Question is, how can I generate new folder everytime but at the same time delete the previous created folder by using JMP script? I dont want my directory full with folder each time i run my script as I only need the latest folder. Below is part of my code. Thank you so much!
dt.file = Pick File();
//Get csv file directory path
prefilepath=substr(dt.file,1,length(dt.file)-length(word(-1,dt.file,"\/"))-1);
If( Host is( Mac ),
filepath="/"||prefilepath,
filepath = Convert File Path( prefilepath, Windows )
);
Show(filepath);
//Create new directory to save all the extracted .csv files
newDir = filepath||Substitute(MDYHMS(Today()), "/", "-", ":", ".");
CreateDirectory(newDir);
Show(newDir);