javascript to create folder and create ini file when folder and file not exist

R
rathasatekun Bronze Contributor
Gosoft (Thailand) Co.,Ltd.

Hi SOTI Comminity

I new for javascript and i have use case that

I will check folder and file  by if not found folder i will create folder 'sdcard/SOTI' and create file 'sdcard/SOTI/info.ini'

how to do with javascript?

I try 

checkFolder();
function checkFolder() {
var foldercheck = new mobicontrol.io.File('/sdcard/.SOTI');
if (foldercheck.exists) {
mobicontrol.log.info('/sdcard/.SOTI exists');
 
}
    else { 
mobicontrol.log.info('/sdcard/.SOTI not exist.')
newFolder();
};
}
newFolder();
function checkFolder() {
var file = new java.io.File('/sdcard/.SOTI');
var path = file.mkdir();
}

But error not module java

My SOTI server version 15.3

and SOTI Client verson 2024.0.4 Build 1056

2 years ago
SOTI MobiControl
ANSWERS