December 20, 2016 at 7:43 am
I'm trying to remember how I would check for the existence of a file and Delete it in a VB.NET Script Task.
If it exist I want to Delete the file and copy the template file to the directory where I deleted the file.
I also want to archive the existing file in another folder.
I'm search for good articles on how to do this in VB.
Does anyone have a good example?
Thanks.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 20, 2016 at 8:10 am
Welsh Corgi (12/20/2016)
I'm trying to remember how I would check for the existence of a file and Delete it in a VB.NET Script Task.If it exist I want to Delete the file and copy the template file to the directory where I deleted the file.
I also want to archive the existing file in another folder.
I'm search for good articles on how to do this in VB.
Does anyone have a good example?
Thanks.
This advanced search finds any number of articles which do the job.
December 20, 2016 at 8:28 am
Actually I'm going to move the file but that is the same principle as a copy.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 20, 2016 at 11:53 am
This line is not right:
File.Copy(sSource, sTarget, True)
What am I missing?
Public Sub Main()
Dim sSource As String
Dim sTarget As String
Dim File As String
sSource = "U:\ZZZ_ImportCreditDataNew\ImportCreditDataNew\Templates\SSISErrorLog.xlsx"
sTarget = "U:\ZZZ_ImportCreditDataNew\ImportCreditDataNew\SSISErrorLog.xlsx"
File.Copy(sSource, sTarget, True)
Dts.TaskResult = ScriptResults.Success
End Sub
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 20, 2016 at 12:04 pm
What am I missing?
A detailed explanation of the problem you are having and details of the error you are receiving.
December 20, 2016 at 12:09 pm
Welsh Corgi (12/20/2016)
What am I missing?
also a try catch to capture any errors raised you did not expect.
Lowell
December 20, 2016 at 12:11 pm
I moved the post to http://www.sqlservercentral.com/Forums/Topic1844606-364-1.aspx
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 20, 2016 at 1:52 pm
Welsh Corgi (12/20/2016)
I moved the post to http://www.sqlservercentral.com/Forums/Topic1844606-364-1.aspx
You really need to not do that anymore. This is the 3rd post on the same subject. Most of the heavy hitters that actually can help you monitor ALL the forums. You moving things around just serves to confuse, split resources, and generally make it more difficult to help you. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply