Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Sun, 15 Jun 2008 18:40:53 +0100,    group: microsoft.public.platformsdk.shell        back       


[CLI] Automatic directory creation w/ auto-counter   
Hello,

I would like to know if it is possible to write a small CLI script (shell 
script?) that will automatically create a directory somewhere by appending a 
kind of auto-counter. Let me illustrate this:

1) Directory to create is (always) 'my_dir_' + <auto_counter>
2) Script reads the file structure and looks for any 'my_dir_<n>' matches. For 
instance:
	my_dir_01
	my_dir_02
	my_dir_03
3) Script then automatically creates the directory by appending the correct 
counter. In this case that would be 'my_dir_04'.

Could someone point me out in the right direction?

Miguel


PS: Please accept my apologies if I've posted in the wrong forum.
date: Sun, 15 Jun 2008 18:40:53 +0100   author:   Miguel Guedes

Re: Automatic directory creation w/ auto-counter   
On Jun 15, 12:40 pm, Miguel Guedes 
wrote:

> 1) Directory to create is (always) 'my_dir_'  <auto_counter>
> 2) Script reads the file structure and looks for any 'my_dir_<n>' matches. For
> instance:
>         my_dir_01
>         my_dir_02
>         my_dir_03
> 3) Script then automatically creates the directory by appending the correct
> counter. In this case that would be 'my_dir_04'.

You can use wildcards with FindFirstFile() to get names of directories
one by one. Use sscanf() or atoi() or your other favorite string-to-
integer function to get the digits at the end of directory name in
integral form.  Keep track of max, add one to max, sprintf() back to
string, then CreateDirectory().

http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa363855.aspx

HTH,

-Le Chaud Lapin-
date: Sun, 20 Jul 2008 00:01:53 -0700 (PDT)   author:   Le Chaud Lapin

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us