Create folders in bulk Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
thephoenix
Posts: 16
Joined: 23 Sep 2019, 18:46

Create folders in bulk

23 Sep 2019, 19:16

I am still a rookie with AHK but hoping to get help with making bulk folder creation simpler.

Currently I do it via command prompt using the usual md foldername1 foldername2 etc. but hoping there is a way to get it via a script where in a text file or gui interface I paste the folder names (5 to 1000 at a time) then it creates the folders as spelled out in text file or gui.

Simply looking for a script to create say 30 folder names (name1, name23, random, 45ggddk3, transfer2 and other random folder names separated by comma or spaces) within a folder in windows. :?:

Thanks for any help provided!
User avatar
flyingDman
Posts: 1009
Joined: 29 Sep 2013, 19:01

Re: Create folders in bulk  Topic is solved

23 Sep 2019, 20:21

Try this:

Code: Select all

folders = 						;this can also be read in from a txt file or and ini file and could also be separated by commas
(
name1
name23
random
45ggddk3
transfer2 
)

FileSelectFolder, oVar					  ;or something like oVar := "c:\documents\somepath" 
if errorlevel							  ;if "cancel" is pressed 		
	exitapp

for k,v in StrSplit(folders,"`n","`r")
	FileCreateDir, % oVar "\" v                       
thephoenix
Posts: 16
Joined: 23 Sep 2019, 18:46

Re: Create folders in bulk

24 Sep 2019, 10:08

That worked like a charm!

Thanks again for the assist!
andrewvanmarle
Posts: 25
Joined: 08 Jul 2019, 07:58

Re: Create folders in bulk

13 Nov 2019, 03:42

Can this also be done in the active folder?

in other words, I have win explorer open and I'd like to create the folders then and there?

Also is there a way toadd a parameter to on of the folder names (that are to be created ) so it will echo the name of the parent folder?

(example: I have a folder open called testing and I want to create new folders in it one of then called documents_testing[/b])

With some Frankenpasting i got to this:

Code: Select all

#IfWinactive, ahk_class CabinetWClass ;Makes the script active only when explorer (window) is active...
 
^F6:: ;Ctrl+F6 hotkey...
 


folders = 						;this can also be read in from a txt file or and ini file and could also be separated by commas
(
Documenten
Presentatie
WWFT
Niet sturen
)


	controlgettext,address,ToolbarWindow323,A ;get address from Navigation Bar...
	address:=RegExReplace(address,".+: ") ;Format it...

oVar := address					  ;or something like oVar := "c:\documents\somepath" 
;if errorlevel							  ;if "cancel" is pressed 		
;	exitapp

for k,v in StrSplit(folders,"`n","`r")
	FileCreateDir, % oVar "\" v  


 
return ;Declare the Hotkey/label's End... 
and that works (not sure if it the cleanest code though)

What I would like to be able to do though is to use the last foldername in "address" and add that to one of the new folders....

is that possible?

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], teadrinker and 50 guests