Multiple folders creation "MD" command.
Moderators: Hacker, petermad, Stefan2, white
Multiple folders creation "MD" command.
I was looking for create SO MANY folders...
Let me SHOW, HOW MANY folders...
Imgur link : https://imgur.com/icwILHb
I am producting an archived folder with subfolders about the "Enciplopédia da Conscienciologia", so this way I had tired with hand working of put commas at my future directories, when I put all the commas and started the .bat executable... The command errored on the spaced and created the names wrong...
HELP ME FOR TREAT ALL THIS FOLDERS...
I need an way for make sure that the directory's names gonna spaced.
Let me SHOW, HOW MANY folders...
Imgur link : https://imgur.com/icwILHb
I am producting an archived folder with subfolders about the "Enciplopédia da Conscienciologia", so this way I had tired with hand working of put commas at my future directories, when I put all the commas and started the .bat executable... The command errored on the spaced and created the names wrong...
HELP ME FOR TREAT ALL THIS FOLDERS...
I need an way for make sure that the directory's names gonna spaced.
Re: Multiple folders creation "MD" command.
I am there waiting for a savior.
Re: Multiple folders creation "MD" command.
Pakylibin wrote: ↑2019-05-18, 03:27 UTC I was looking for create SO MANY folders...
Imgur link : https://imgur.com/icwILHb
...so this way I had tired with hand working of put commas at my future directories,
when I put all the commas and started the .bat executable... The command errored on the spaced and created the names wrong...
Learn some DOS basics and put the folder names "inside quotes".
Re: Multiple folders creation "MD" command.
There are sooo many good text editors which support regular expressions… Choose one of them and you will have every name in a separate line.
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
- clifford_cooley
- Junior Member
- Posts: 40
- Joined: 2019-03-05, 06:04 UTC
- Location: USA
Re: Multiple folders creation "MD" command.
Try this vbs(visial basic script) file I rebuilt for you. I already had one similar created for myself.
Note: The script is a plain text file with a .vbs extension. You can name the script anything you wish as long as the extension is .vbs.
Code: Select all
' Create an array of all folder names
MyArray=Array( "Conscientia libera (CL)","Conscientia transmigrans","Consciex anticonflictiva" ):
' Loop through listings in the array, and create folder if it does not exist
For count = 0 To uBound(MyArray):
strFolder = MyArray(count):
set objFSO = createobject("Scripting.FileSystemObject"):
if objFSO.FolderExists(strFolder) = False then objFSO.CreateFolder strFolder:
Next:
License #116347
Re: Create multiple folders with VBScript or PowerShell or DOS MD makedir
Oh, so many help? Great forum. Here is my solution, a VBScript:
- read in whole "Homines.txt"
- split long string at comma into an array
- for each array item
- - - trim whitespaces
- - - check if folder already exists, if not, create the folder
HTH?
>> below the same in PowerShell > viewtopic.php?p=355561#p355561
- read in whole "Homines.txt"
- split long string at comma into an array
- for each array item
- - - trim whitespaces
- - - check if folder already exists, if not, create the folder
Code: Select all
' Total Commander VBScript "Create Folders from List.vbs" by Stefan, 2019-05-18, v0.01
' Found at: https://ghisler.ch/board/viewtopic.php?p=355349#p355349
'// U S E R S E T T I N G S
'- go to your main folder for to create the new folders
'- have the text file with the list of folders to create
strFolderList = "Homines.txt"
'- save this vbs code as plain text file "Create Folders from List.vbs"
'- double click this VBS
'// T H E C O D E - - - - - - - - - - - - - - - - - -
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = FSO.OpenTextFile(strFolderList,1)
strFolderList = oTextStream.ReadAll
oTextStream.Close
FldArray = split(strFolderList,",")
For FldIndex=0 To UBound(FldArray)
strFldName= trim(FldArray(FldIndex))
If strFldName <> "" Then
' DEBUG
'comment-out the next two lines if wanted:
MsgBox "Create : " & strFldName
If FldIndex=4 Then WScript.Quit
' /End DEBUG
'un-comment next line for to create the folders:
'If not (FSO.FolderExists(strFldName)) Then FSO.CreateFolder(strFldName)
End If
Next
'- - - - - - - - - - - - - - - - - - - - - - - - - - -
HTH?
>> below the same in PowerShell > viewtopic.php?p=355561#p355561
Re: Multiple folders creation "MD" command.
I'm talking about using Windows Notepad to create folders but to enclose names between quotation mark to enable OP's .bat file creating folder with names contain space character.
Re: Multiple folders creation "MD" command.
2ts4242
Did you really try to use "Replace all" in a large text file with Notepad in Windows XP?
Did you really try to use "Replace all" in a large text file with Notepad in Windows XP?
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
- clifford_cooley
- Junior Member
- Posts: 40
- Joined: 2019-03-05, 06:04 UTC
- Location: USA
Re: Multiple folders creation "MD" command.
I always use Wordpad myself. I don't care much for Notepad.
License #116347
Re: Multiple folders creation "MD" command.
2ts4242
Don't you think that the supposed command is too long to fit in a single line?
How do you want to split the content to many lines in Notepad?
Don't you think that the supposed command is too long to fit in a single line?
How do you want to split the content to many lines in Notepad?
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
- clifford_cooley
- Junior Member
- Posts: 40
- Joined: 2019-03-05, 06:04 UTC
- Location: USA
Re: Multiple folders creation "MD" command.
Are we arguing about how to create an invalid syntax for a command-line command? If it is not invalid, please explain. Nothing I have ever read suggest more than one folder can be created from the same script line. From MD help text, each nested folder* needs its own MD command line.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/md
Or type one of the following from TC command-line box.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/md
Or type one of the following from TC command-line box.
- cmd /k help md
- cmd /k md /?
License #116347
- clifford_cooley
- Junior Member
- Posts: 40
- Joined: 2019-03-05, 06:04 UTC
- Location: USA
Re: Multiple folders creation "MD" command.
After taking a few minutes trying different syntax, I have created multiple folders using the following command.clifford_cooley wrote: ↑2019-05-19, 13:32 UTCNothing I have ever read suggest more than one folder can be created from the same script line.
MD "Folder One" "Folder Two"
Notice there are no commas for parameter delimiter. So the correct edit would be to replace all the |,| with |" "| not |","|
But then there is a max character limit of 8191 (pre-XP: 2047) for each command line.
https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation
License #116347