VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script

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.

Rate To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script




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
'=============================================================


Download this snippet    Add to My Saved Code

To Create Single or Multiple Folders and In that folder automatically create Sub Folders by Script Comments

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 .

Post your comment

Subject:
Message:
0/1000 characters