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.
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-