<HTML><HEAD>
<TITLE>Create a Folder</TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function validate() {
	if(document.form.dir.value<=0 || document.form.fName.value<=0) { document.write('Error!');return false;}
	else folder();document.write('Folder <B>'+document.form.fName.value+'</B> successfully created in '+document.form.dir.value+'');
}
function folder(path,fName) {
	var obj, get, sub, add;
	obj = new ActiveXObject("Scripting.FileSystemObject");
	get = obj.GetFolder(document.form.dir.value);
	sub = get.SubFolders;
	if (fName != "" )
	add = sub.Add(document.form.fName.value);
	else add = sub.Add("Name of new folder");
}
</SCRIPT>
</HEAD><BODY>
<FORM NAME="form" onSubmit="validate();return false">
<INPUT TYPE="text" ID="dir" VALUE="C:\" NAME="dir" SIZE=20>
<INPUT TYPE="text" ID="fName" VALUE="New Folder" NAME="fName" SIZE=10>
<BUTTON TYPE="submit">Create Folder</BUTTON>
</FORM>
Published in: ActiveX
Download

Related snippets