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


(Read 879 times - 0 Members and 1 Guest are viewing this topic.)
 Reply Send this topic Print Anmelden / Register

Windows board » Your question: How do I make 1000 folders, then automatically number them

Pages: [1]

burgess.victor
Guest

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

« 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?
Report to moderator   Logged


nico Offline nicos PC
Administrator (6.570)
*****

Re: Your question: How do I make 1000 folders, then automatically number them

« Reply #1 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
 
Report to moderator   Logged


Lisaa Offline
Sr. Member Pro (3.894)
*****

Re: Your question: How do I make 1000 folders, then automatically number them

« Reply #2 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 & 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.  
« Last Edit: 23.06.08, 15:29:29 by Lisaa » Report to moderator   Logged

Pages: [1]  Reply Send this topic Print Anmelden / Register 

add bookmark Bookmark:
Jump to:  





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