Jump to content

need a batch script to create multiple folders

Recommended Posts

Hello all,

I need to be able to create a batchfile to create 500 folders each with a single folder inside of them. The names of the folders are labelled "00501" through "01000", and the folder inside each is called "Results". I'm not very experienced at all with batch scripting, so any help at all would be appreciated.

Link to post
Share on other sites

create a batch file with this code

md 00501\results
md 00502\results
md 00503\results
md 00504\results
md 00505\results
md 00506\results
md 00507\results
md 00508\results
md 00509\results
md 00510\results
md 00511\results
md 00512\results
md 00513\results
md 00514\results
md 00515\results
md 00516\results
md 00517\results
md 00518\results
md 00519\results
md 00520\results
md 00521\results
md 00522\results
md 00523\results
md 00524\results
md 00525\results
md 00526\results
md 00527\results
md 00528\results
md 00529\results
md 00530\results
md 00531\results
md 00532\results
md 00533\results
md 00534\results
md 00535\results
md 00536\results
md 00537\results
md 00538\results
md 00539\results
md 00540\results
md 00541\results
md 00542\results
md 00543\results
md 00544\results
md 00545\results
md 00546\results
md 00547\results
md 00548\results
md 00549\results
md 00550\results
md 00551\results
md 00552\results
md 00553\results
md 00554\results
md 00555\results
md 00556\results
md 00557\results
md 00558\results
md 00559\results
md 00560\results
md 00561\results
md 00562\results
md 00563\results
md 00564\results
md 00565\results
md 00566\results
md 00567\results
md 00568\results
md 00569\results
md 00570\results
md 00571\results
md 00572\results
md 00573\results
md 00574\results
md 00575\results
md 00576\results
md 00577\results
md 00578\results
md 00579\results
md 00580\results
md 00581\results
md 00582\results
md 00583\results
md 00584\results
md 00585\results
md 00586\results
md 00587\results
md 00588\results
md 00589\results
md 00590\results
md 00591\results
md 00592\results
md 00593\results
md 00594\results
md 00595\results
md 00596\results
md 00597\results
md 00598\results
md 00599\results
md 00600\results
md 00601\results
md 00602\results
md 00603\results
md 00604\results
md 00605\results
md 00606\results
md 00607\results
md 00608\results
md 00609\results
md 00610\results
md 00611\results
md 00612\results
md 00613\results
md 00614\results
md 00615\results
md 00616\results
md 00617\results
md 00618\results
md 00619\results
md 00620\results
md 00621\results
md 00622\results
md 00623\results
md 00624\results
md 00625\results
md 00626\results
md 00627\results
md 00628\results
md 00629\results
md 00630\results
md 00631\results
md 00632\results
md 00633\results
md 00634\results
md 00635\results
md 00636\results
md 00637\results
md 00638\results
md 00639\results
md 00640\results
md 00641\results
md 00642\results
md 00643\results
md 00644\results
md 00645\results
md 00646\results
md 00647\results
md 00648\results
md 00649\results
md 00650\results
md 00651\results
md 00652\results
md 00653\results
md 00654\results
md 00655\results
md 00656\results
md 00657\results
md 00658\results
md 00659\results
md 00660\results
md 00661\results
md 00662\results
md 00663\results
md 00664\results
md 00665\results
md 00666\results
md 00667\results
md 00668\results
md 00669\results
md 00670\results
md 00671\results
md 00672\results
md 00673\results
md 00674\results
md 00675\results
md 00676\results
md 00677\results
md 00678\results
md 00679\results
md 00680\results
md 00681\results
md 00682\results
md 00683\results
md 00684\results
md 00685\results
md 00686\results
md 00687\results
md 00688\results
md 00689\results
md 00690\results
md 00691\results
md 00692\results
md 00693\results
md 00694\results
md 00695\results
md 00696\results
md 00697\results
md 00698\results
md 00699\results
md 00700\results
md 00701\results
md 00702\results
md 00703\results
md 00704\results
md 00705\results
md 00706\results
md 00707\results
md 00708\results
md 00709\results
md 00710\results
md 00711\results
md 00712\results
md 00713\results
md 00714\results
md 00715\results
md 00716\results
md 00717\results
md 00718\results
md 00719\results
md 00720\results
md 00721\results
md 00722\results
md 00723\results
md 00724\results
md 00725\results
md 00726\results
md 00727\results
md 00728\results
md 00729\results
md 00730\results
md 00731\results
md 00732\results
md 00733\results
md 00734\results
md 00735\results
md 00736\results
md 00737\results
md 00738\results
md 00739\results
md 00740\results
md 00741\results
md 00742\results
md 00743\results
md 00744\results
md 00745\results
md 00746\results
md 00747\results
md 00748\results
md 00749\results
md 00750\results
md 00751\results
md 00752\results
md 00753\results
md 00754\results
md 00755\results
md 00756\results
md 00757\results
md 00758\results
md 00759\results
md 00760\results
md 00761\results
md 00762\results
md 00763\results
md 00764\results
md 00765\results
md 00766\results
md 00767\results
md 00768\results
md 00769\results
md 00770\results
md 00771\results
md 00772\results
md 00773\results
md 00774\results
md 00775\results
md 00776\results
md 00777\results
md 00778\results
md 00779\results
md 00780\results
md 00781\results
md 00782\results
md 00783\results
md 00784\results
md 00785\results
md 00786\results
md 00787\results
md 00788\results
md 00789\results
md 00790\results
md 00791\results
md 00792\results
md 00793\results
md 00794\results
md 00795\results
md 00796\results
md 00797\results
md 00798\results
md 00799\results
md 00800\results
md 00801\results
md 00802\results
md 00803\results
md 00804\results
md 00805\results
md 00806\results
md 00807\results
md 00808\results
md 00809\results
md 00810\results
md 00811\results
md 00812\results
md 00813\results
md 00814\results
md 00815\results
md 00816\results
md 00817\results
md 00818\results
md 00819\results
md 00820\results
md 00821\results
md 00822\results
md 00823\results
md 00824\results
md 00825\results
md 00826\results
md 00827\results
md 00828\results
md 00829\results
md 00830\results
md 00831\results
md 00832\results
md 00833\results
md 00834\results
md 00835\results
md 00836\results
md 00837\results
md 00838\results
md 00839\results
md 00840\results
md 00841\results
md 00842\results
md 00843\results
md 00844\results
md 00845\results
md 00846\results
md 00847\results
md 00848\results
md 00849\results
md 00850\results
md 00851\results
md 00852\results
md 00853\results
md 00854\results
md 00855\results
md 00856\results
md 00857\results
md 00858\results
md 00859\results
md 00860\results
md 00861\results
md 00862\results
md 00863\results
md 00864\results
md 00865\results
md 00866\results
md 00867\results
md 00868\results
md 00869\results
md 00870\results
md 00871\results
md 00872\results
md 00873\results
md 00874\results
md 00875\results
md 00876\results
md 00877\results
md 00878\results
md 00879\results
md 00880\results
md 00881\results
md 00882\results
md 00883\results
md 00884\results
md 00885\results
md 00886\results
md 00887\results
md 00888\results
md 00889\results
md 00890\results
md 00891\results
md 00892\results
md 00893\results
md 00894\results
md 00895\results
md 00896\results
md 00897\results
md 00898\results
md 00899\results
md 00900\results
md 00901\results
md 00902\results
md 00903\results
md 00904\results
md 00905\results
md 00906\results
md 00907\results
md 00908\results
md 00909\results
md 00910\results
md 00911\results
md 00912\results
md 00913\results
md 00914\results
md 00915\results
md 00916\results
md 00917\results
md 00918\results
md 00919\results
md 00920\results
md 00921\results
md 00922\results
md 00923\results
md 00924\results
md 00925\results
md 00926\results
md 00927\results
md 00928\results
md 00929\results
md 00930\results
md 00931\results
md 00932\results
md 00933\results
md 00934\results
md 00935\results
md 00936\results
md 00937\results
md 00938\results
md 00939\results
md 00940\results
md 00941\results
md 00942\results
md 00943\results
md 00944\results
md 00945\results
md 00946\results
md 00947\results
md 00948\results
md 00949\results
md 00950\results
md 00951\results
md 00952\results
md 00953\results
md 00954\results
md 00955\results
md 00956\results
md 00957\results
md 00958\results
md 00959\results
md 00960\results
md 00961\results
md 00962\results
md 00963\results
md 00964\results
md 00965\results
md 00966\results
md 00967\results
md 00968\results
md 00969\results
md 00970\results
md 00971\results
md 00972\results
md 00973\results
md 00974\results
md 00975\results
md 00976\results
md 00977\results
md 00978\results
md 00979\results
md 00980\results
md 00981\results
md 00982\results
md 00983\results
md 00984\results
md 00985\results
md 00986\results
md 00987\results
md 00988\results
md 00989\results
md 00990\results
md 00991\results
md 00992\results
md 00993\results
md 00994\results
md 00995\results
md 00996\results
md 00997\results
md 00998\results
md 00999\results
md 10000\results

Link to post
Share on other sites

Here is a VBS script that will do what you want

Save As MK_FiveHundredFolders.vbs

'-> Object For Run Time
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
'-> Varibles For Run Time
Dim C1,i
'-> Loop For 500 Objects
For i = 1 To 500
C1 = i + 500
'-> Add Zero To Number
If Len(C1) = 3 Then C1 = "00" & C1
If Len(C1) = 4 Then C1 = "0" & C1
If Len(C1) = 5 Then C1 = C1
'-> Uncommecnt For Debugging Only
' WScript.Echo C1
'-> Make The Folder If It Not There
If Not Fso.FolderExists(C1) Then Fso.CreateFolder(C1)
If Not Fso.FolderExists(C1 & "\Results") Then Fso.CreateFolder(C1 & "\Results")

Link to post
Share on other sites

This should suffice as long as you don't already have some of those directories already existing:

FOR /L %%# IN (100501,1,101000) DO SET "_=%%#" & MD !_:~1!\Results


I read all the way through your script:

create a batch file with this code

md 00501\results
md 00502\results
<snip />
md 00999\results
md 10000\results

…and you made a mistake on the last line!
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...