Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:28:33+00:00 2026-06-06T15:28:33+00:00

I have a requirement to download multiple CSV files from a remote FTP site.

  • 0

I have a requirement to download multiple CSV files from a remote FTP site. I am leveraging SSIS because that is the only tool available on site. I do have FTP script which downloads all files and a for each loop which allows me to merge all files.

I would like to convert files to a TAB delimited format to avoid commas in the data from splitting fields (or if someone has another solution I am willing to listen). I have a VB script which does convert the files but I’d like to leverage a task such as ActiveX Script Task or Script Task to run the script within SSIS. How can I insert/convert the script to use one of these tasks? Below is the code I am using to convert the files.

Dim objFSO, objFile, objFileTSV
Dim strLine, strNewLine, strNewText
Dim FileNameLength, LineLength, NewFileName, Linepos, Quote, QuoteCount, TotalFilesConverted

Set objFSO = CreateObject("scripting.filesystemobject")
strCurPath = objFSO.GetAbsolutePathName(".")
TotalFilesConverted = 0

For Each objFile In objFSO.getfolder(strCurPath).Files
    If UCase(Right(objFile.Name, 4)) = ".CSV" Then
        FileNameLength = Len(objFile.Name)-4
        NewFileName = Left(objFile.Name,FileNameLength) & ".tsv"
        Set objFile = objFSO.OpenTextFile(objFile, 1)

        Do Until objFile.AtEndOfStream
            strLine = objFile.ReadLine
            LineLength = Len(strLine)
            Linepos =1
            strNewLine =""
            Quote = False
            QuoteCount = 0

            Do While Linepos <= LineLength
                If mid(strLine, Linepos, 1) = "," and Not Quote Then 
                    strNewLine = strNewLine + vbTab
                    Quote = False
                Elseif mid(strLine, Linepos, 1) = Chr(34) Then
                    QuoteCount = QuoteCount +1
                    If QuoteCount =2 and Linepos <> LineLength Then
                        If mid(strLine, Linepos, 2) = Chr(34) & Chr(34) Then
                            strNewLine = strNewLine + Chr(34)
                            Linepos = Linepos +1
                            Quote = True
                            QuoteCount = 1
                        Else
                            Quote = False
                            QuoteCount = 0
                        End If
                    Else 
                        Quote = True
                    End If
                Else
                    strNewLine = strNewLine + Mid(strLine, Linepos, 1)
                End If
                Linepos = Linepos +1
            Loop
            strNewText = strNewText & strNewLine & vbCrLF
        Loop
        objFile.Close

        Set objFileTSV = objFSO.CreateTextFile(NewFileName)
        objFileTSV.WriteLine strNewText
        TotalFilesConverted = TotalFilesConverted +1
        strNewText = ""
        objFileTSV.Close

    End If
Next

MsgBox CStr(TotalFilesConverted) + " Files Converted from CSV to TSV."
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:28:35+00:00Added an answer on June 6, 2026 at 3:28 pm

    Since the SSIS Script Task object gives you the choice of either C# or VB.NET, you can track down plenty of code ideas on how to parse a CSV file (see Parse Delimited CSV in .NET for instance).

    Also, looping through the file system in .NET is very easily done:

    For Each dirItem As String In System.IO.Directory.EnumerateFileSystemEntries(DirPath)
        ' Insert code here ...
    Next
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have requirement where in i want to download the files from different machines
I have a view that protects certain sensitive files from public download, using nginx'
In our project we have requirement that, after receiving sms message from third party
I have a 1GB binary file on another system. Requirement: ftp/download and convert binary
My requirement is that to download xml from server and save it into sd-card
We have a requirement to download multiple documents, zip them and allow user to
I have requirement of specifying web part connections in onet.xml. So when site is
Am working on an application which has a requirement to download bulk data from
I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is
I have an application that downloads most of the resources from the internet during

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.