Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have users create folders/ directories on network drive

Status
Not open for further replies.

mmohawk

IS-IT--Management
Jan 8, 2003
19
US
I'm looking for a way to let my users create folders on a network drive. They are very uneducated. I want to create a script that they could open that would ask them what they would like to do.
It would ask "What directory would you like?" They would input what the want. It would create that directory if it does not exist. Then it would ask "What sub-directory would you like?" Then it would create that sub-directory.
I would also like it to be able to copy certain files from another directory to the sub-directory that it just created.

I'm not a programmer so any help would be greatly appreciated.


Thanks, Mic
 
No problem mic. Copy and paste this code to a text file. Give it a VBS extension and yuou are good to go. This uses the X drive as an example. You can modify just that and put a copy of the script in the root of each network drive or you could modify to prompt for the network drive. I'm sure you can figure out that modification from the rest of the script if you need to. Enjoy.

Mark D. MacLachlan


'==========================================================================
' NAME: buildFolders.vbs
'
' AUTHOR: Mark D. MacLachlan , the Spider's Parlor
' URL: ' (c) 2003 All Rights Reserved
' DATE : 12/21/2003
'
' COMMENT: Creates folders and sub folders on a network drive
'
'==========================================================================
Dim fso, baseDir, netDrive, subPrompt

netDrive = "x:\"
Set fso = CreateObject("Scripting.FileSystemObject")

baseDir = InputBox ("What Directory would you like to create?")
If Not fso.FolderExists (netDrive & baseDir) Then
fso.CreateFolder(netDrive & baseDir)
buildSubDirectories
Else
MsgBox "The directory name already exists."
buildSubDirectories
End If

Sub buildSubDirectories
subPrompt = InputBox("Enter sub directory name to be created.")
fso.CreateFolder(netDrive & baseDir &"\" & subPrompt)
buildMore = MsgBox ("Sub Directory has been created. Would you like to create another subdirectory?" & VBCrLf & "Note: You can create nested sub directories by adding more path information such as directory1\directory2", _
VbYesNo OR VBDefaultButton2, "create another subdirectory")
If buildMore = VbNo then
Wscript.Quit
Else
buildSubDirectories
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top