Computerhilfen.com: Your question: How do I make 1000 folders, then automatically number them

English help boards: Windows board: Topic started by: burgess.victor on 23.06.08, 07:02:21
Thema lesen und antworten: http://www.computerhilfen.com/hilfen-24-239052-0.html
Mit dem Handy lesen und antworten: http://mobil.computerhilfen.com/mobil-hilfen-24-239052-0.html




Title: Your question: How do I make 1000 folders, then automatically number them
Post by: burgess.victor on 23.06.08, 07:02:21
I need to make 1000 folders named Victor 001 - Victor 1000. How do i do it using a macro?



Title: Re: Your question: How do I make 1000 folders, then automatically number them
Post by: nico on 23.06.08, 08:27:22
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




Title: Re: Your question: How do I make 1000 folders, then automatically number them
Post by: Lisaa on 23.06.08, 15:25:04
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 (http://www.computerhilfen.com/explanation-c-Copy.html) & paste into a batch file (e.g. create.bat) and run it from the directory (http://www.computerhilfen.com/explanation-d-Directory.html) 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 (http://www.computerhilfen.com/explanation-b-BIT.html) complicated because it was quite tricky to get the leading zeroes.  



Computerhilfen.com | Powered by SMF 2.5.1.
© 2001-2008, Lewis Media. All Rights Reserved.