SXGuy Posted January 5, 2010 Posted January 5, 2010 (edited) Im trying to write a script which will create x amount of folders with a given name using an array or similar. But im having trouble getting the folders to be created exactly where i want them to be using an array. My example code is: #include <Array.au3> $text = "Clients\" $user = "Paul\Chris\Frank\" $array = StringSplit($user, '\', 1) Dircreate("C:\Documents and Settings\Administrator\desktop\" & $text & $user) I understand the way i have written is its not correct for my purpose but i am unable to work out how i rewrite it so it is. Ill explain what i want to do. I want to first create a folder called Clients, then create multiple subfolders called Paul, Chris and Frank. The problem i have is, each sub folder is being created inside the previous, rather than all being created in the Clients folder. Example: Result is Clients\Paul\Chris\Frank But i want Clients\Paul Clients\Chris Clients\Frank. How can i modify the code to achieve this? Thanks for any help you can give. Edited January 5, 2010 by SXGuy
Xenobiologist Posted January 5, 2010 Posted January 5, 2010 $text = "Clients\" $user = "Paul\Chris\Frank" $array = StringSplit($user, '\', 2) For $i = 0 To UBound($array) - 1 DirCreate(@DesktopDir & '\' & $text & '\' & $array[$i]) Next Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
SXGuy Posted January 5, 2010 Author Posted January 5, 2010 Thank you! I knew it would be something along those lines, but just wasnt sure. This has really helped, thanks again.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now