Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > BI Monkey
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Getting File Information with the Script Task

This is a discussion on Getting File Information with the Script Task within the BI Monkey forums, part of the CORTEX Blogs category; A requirement for a current client is to capture some information about Flat Files being loaded for logging purposes. Fortunately this is a easy job for the Script Task, using ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 26th August 2009, 07:37 PM   #1
Guru
 
Join Date: Jun 2009
Posts: 122
James Beresford is on a distinguished road
Thumbs up Getting File Information with the Script Task

A requirement for a current client is to capture some information about Flat Files being loaded for logging purposes. Fortunately this is a easy job for the Script Task, using the following VB.Net code:
Public Sub Main()

‘ String variable to hold file name
Dim strFileName As String

‘ File name (including path) passed in from container
strFileName = Dts.Variables(”User::FileName”).Value.ToString

‘ Create a System.IO.FileInfo object to retrieve the data
Dim FileObject As System.IO.FileInfo = New System.IO.FileInfo(strFileName)

‘ Return the information via a message box
MsgBox(”File name ” + FileObject.FullName + ” created on ” + FileObject.CreationTime.ToString)

End Sub

The sample package for this post can be found here. To see what other properties can be obtained, just use Intellisense on the FileObject object in the code.



Get More from the original blog...
James Beresford is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flat File Sources and the Decimal Data Type James Beresford BI Monkey 0 27th July 2009 08:22 PM
Flat File Import tips James Beresford BI Monkey 0 23rd June 2009 09:34 PM
IBM to Acquire Solid Information Technology to Broaden Information on Demand Portfoli Latest News Headlines 2007 News 0 26th December 2007 06:38 PM


All times are GMT +11. The time now is 03:03 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO