Please register or login. There are 0 registered and 1434 anonymous users currently online. Current bandwidth usage: 326.30 kbit/s December 13 - 12:16am EST 
Hardware Analysis
      
Forums Product Prices
  Contents 
 
 

  Latest Topics 
 

More >>
 

    
 
 

  You Are Here: 
 
/ Forums / Programming /
 

  Creating sequentially named folders with a batch file 
 
 Author 
 Date Written 
 Tools 
Continue Reading on Page: 1, 2
James Turner Jan 29, 2013, 04:39pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Jan 29, 2013, 04:55pm EST

 
>> Re: Creating sequentially named folders with a batch file
Love the powershell script. Works great. Wondering if you can use the same script to add a subdirectory to each folder created. Such as adding a folder called "data". Thanks.

=================================================

Actually figured it out after I posted this.

Here is the additional line I added to your script:

For ($i=$start; $i -le $end; $i++) { New-Item -ItemType directory -Path $path/$($name + $i.ToString($pad)) -Name Data }

Now I'm just wondering if there is an easy way to turn off the verbose output in the powershell window?

Want to enjoy less advertisements and more features? Click here to become a Hardware Analysis registered user.
Keith Braud Jan 30, 2013, 07:55am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Creating sequentially named folders with a batch file
Has it been fixed or not and where was error in the code?

Dr. Peaceful Feb 01, 2013, 05:59pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Creating sequentially named folders with a batch file
James Turner said:
Love the powershell script. Works great. Wondering if you can use the same script to add a subdirectory to each folder created. Such as adding a folder called "data". Thanks.

=================================================

Actually figured it out after I posted this.

Here is the additional line I added to your script:

For ($i=$start; $i -le $end; $i++) { New-Item -ItemType directory -Path $path/$($name + $i.ToString($pad)) -Name Data }

Now I'm just wondering if there is an easy way to turn off the verbose output in the powershell window?

Glad you figure it out yourself. You should put the New-Item line within the same loop, so don't need to loop twice.

For ($i=$start; $i -le $end; $i++) {
New-Item -ItemType directory -Path $path -Name $($name + $i.ToString($pad))
New-Item -ItemType directory -Path $path/$($name + $i.ToString($pad)) -Name Data
}


As for verbose, unfortunately since the program is using Powershell's own validate function, can't avoid getting a long error message, if the parameter is not right. You can always redirect the output to a temp file, so you don't have to see it.


Write a Reply >>

Continue Reading on Page: 1, 2

 

    
 
 

  Topic Tools 
 
RSS UpdatesRSS Updates
 

  Related Articles 
 
 

  Newsletter 
 
A weekly newsletter featuring an editorial and a roundup of the latest articles, news and other interesting topics.

Please enter your email address below and click Subscribe.