Startseite
Hilfe-ForumFrageSuchenKontakt/Impressum

ForenForum
Your question: How do I make 1000 folders, then automatically number them
Von: burgess.victor
am 23.06.2008


I need to make 1000 folders named Victor 001 - Victor 1000. How do i do it using a macro?

Antwort 1 von nico *****
am 23.06.2008


With the VB macros in MS Office, you can create folders with a syntax like:

Code:
MkDir DirName


Because I don't know much about programming in VB, I hope the following links help you to insert the counting variable into the DirName:


http://exceltips.vitalnews.com/Pages/T002462_Creating_a_Directory_in_a_Macro.html
http://en.allexperts.com/q/Microsoft-Word-1058/Creating-new-folder-using-1.htm
http://www.pcreview.co.uk/forums/thread-956392.php
 

Antwort 2 von Lisaa *****
am 23.06.2008


Do you need a VB macro? A simple(1) command line script could do the trick as well:

FOR /L %%i IN (1,1,1000) DO (IF %%i LSS 10 (mkdir "Victor 000%%i") ELSE (IF %%i LSS 100 (mkdir "Victor 00%%i") ELSE (IF %%i LSS 1000 (mkdir "Victor 0%%i") ELSE mkdir "Victor %%i")))

Just copy & paste into a batch file (e.g. create.bat) and run it from the directory where the subdirectories should be created. Please note that this is actually just one line, so make sure the command is not truncated by a newline or so.

(1) OK, looks a bit complicated because it was quite tricky to get the leading zeroes.