by Yogesh Ovhal (1 Submission)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 14th August 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script ,In the location where that Script resides.
Dim lMsg
Dim objFSO
dim objShell
dim lFdName
dim lArray
dim i
dim lSubFdname
dim l2SubFdname
dim lPath
'---Create shell and filesystem objects
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
lSubFDName = "\Windows NT 5.1 Workstatoin Profile"
l2SubFDName = "\Notes_Cdi"
'lpath=InputBox("PLease enter Folder Path Here", "Yogi want Location")
lpath = WScript.ScriptFullName
lpath = Left(lpath, InstrRev(lpath, "\"))
if not right(lpath,1) = "\" then
lpath=lpath & "\"
end if
lfdname = InputBox("PLease enter GID Here", "Yogi want folder name")
if lfdname = "" then
call MsgBox("Please Enter the Folder Name !", vbCritical, "Yogi need Folder Name")
else
if instr(1,lfdname,",") > 0 then
lArray=split(lfdname,",")
for i = 0 to ubound(lArray)
lfdname=lArray(i)
if not lcase(left(lfdname,1)) = "u" then
lfdname="u" & lfdname
end if
lmsg=msgbox("are u sure want to create: " & lfdname & " Folder",vbyesno,"Yogi want confirmation")
if lmsg=vbyes then
If Not objFSO.folderexists(lpath & lfdname) Then
objFSO.CreateFolder(lpath & lfdname)
objFSO.CreateFolder(lpath & lfdname & "\" & lsubfdname)
objFSO.CreateFolder(lpath & lfdname & "\" & l2subfdname)
msgBox("Folder Ctreated.")
else
msgbox("Folder Already Exist!!")
end if
end if
next
else
if not lcase(left(lfdname,1)) = "u" then
lfdname="u" & lfdname
end if
lmsg=msgbox("are u sure want to create: " & lfdname & " Folder",vbyesno,"Yogi want confirmation")
if lmsg=vbyes then
If Not objFSO.folderexists(lpath & lfdname) Then
objFSO.CreateFolder(lpath & lfdname)
objFSO.CreateFolder(lpath & lfdname & "\" & lsubfdname)
objFSO.CreateFolder(lpath & lfdname & "\" & l2subfdname)
msgBox("Folder Ctreated.")
else
msgbox("Folder Already Exist!!")
end if
end if
end if
end if 'if lfdname = "" then
'---Clean up
Set objShell = Nothing
Set objFSO = Nothing
'=============================================================
'End Main Processing
'=============================================================
No comments have been posted about To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script . Why not be the first to post a comment about To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script .