Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-15-2011, 10:33 AM
dafergu2 dafergu2 is online now
Registered User
 
Join Date: 04-14-2011
Posts: 4
Process each file in a folder

I have a folder of sql scripts that need to be executed in a specific order. The order is based on a number that is at the beginning of the file name. For example:

100_Sql1.sql
200_Sql2.sql
4000_Sql3.sql
10000_Sql4.sql

Does VBP have a built in mechanism for something like this or do I need to write a script for this?

Thanks!
Reply With Quote
  #2  
Old 04-15-2011, 11:16 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The Process Files action always processes in sorted order (actually it's the order returned by FindNextFile, which is alphabetical on NTFS -- see http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx). One option would be to name the files so the sorted order is correct (i.e., by left-padding with zeros). The attached project would rename the files to sort properly.

Otherwise, you would need to manually sort (iterate with process files and store in sorted order) and then iterate over the sorted list.
Attached Files
File Type: bld sortfiles.bld (2.4 KB, 1474 views)
Reply With Quote
  #3  
Old 04-15-2011, 11:21 AM
dafergu2 dafergu2 is online now
Registered User
 
Join Date: 04-14-2011
Posts: 4
Thanks for the suggestions. The manual iteration is probably the best solution for us at this point. How would I tie that into the Process Files action?
Reply With Quote
  #4  
Old 04-15-2011, 12:36 PM
dafergu2 dafergu2 is online now
Registered User
 
Join Date: 04-14-2011
Posts: 4
I've got a good first step at it. Another followup question...the rename action in the loop outputs its action step name every iteration of the loop.

Is there a way to disable actions from printing its exectution status?

For example...

4/15/2011 1:31:25 PM: Building project step 'Loop through temporary change script folder'...
4/15/2011 1:31:25 PM: Building project step 'Rename file'...
4/15/2011 1:31:25 PM: Building project step 'Loop through temporary change script folder'...
4/15/2011 1:31:25 PM: Building project step 'Rename file'...
4/15/2011 1:31:25 PM: Building project step 'Loop through temporary change script folder'...
4/15/2011 1:31:25 PM: Building project step 'Rename file'...
4/15/2011 1:31:25 PM: Building project step 'Loop through


When I have 229 files in my loop, it spams the log with a bunch of noise. Is there a way I can turn that off? I tried clicking Disable Action Output, but that did not work.

Thanks!
Reply With Quote
  #5  
Old 04-15-2011, 12:46 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Here's one way to do the sort (attached).

As far as log output, see Tools | User Options | Output -> Logging of step starting events (for the Output pane) or Tools | Application Options | Logging (More) -> Text Format Logging Options (for text log files).
http://www.kinook.com/VisBuildPro/Ma...putuseropt.htm
http://www.kinook.com/VisBuildPro/Ma...ingmoreopt.htm
Attached Files
File Type: bld sortfiles2.bld (2.8 KB, 1482 views)
Reply With Quote
  #6  
Old 04-15-2011, 01:03 PM
dafergu2 dafergu2 is online now
Registered User
 
Join Date: 04-14-2011
Posts: 4
Awesome, thanks!!

Do the log settings work with the console application? We want to build a set of developer scripts using vbp and have them run via powershell.

We're planning on having the console vbp app run the build files from a scripts directory in our source. We were hoping to copy the console app to our svn tools dir so that we don't have to hardcode machine paths in our scripts.

I looked for the application config files in the specified folder:

C:\ProgramData\Kinook Software\Visual Build Professional 7

but the folder was empty.
Reply With Quote
  #7  
Old 04-15-2011, 01:38 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The console app output does not use the Application or User options (although this is on the todo list), but the log file output uses the App log settings whether built with the console or GUI app.

You can copy the console app to another folder and run from there. See here for where the application options get loaded from (the config file won't get created until changes are made to app options and VBP exits).
http://www.kinook.com/VisBuildPro/Ma...ationfiles.htm
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 12:06 PM.


Copyright © 1999-2023 Kinook Software, Inc.