Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

using SSIS to FTP  to a server and pull csv onto another drive

Posted on 2011-02-25
3
287 Views
Last Modified: 2012-11-28
Hi,
I have a file i want to access, and take the latest csv file saved in that folder.

I can FTP to this server
and in this folder is a list of all the csv files that are saved daily.

if there were only one new file saved there every day, and nothing else in the folder and the same name for this new file, then i can get my package to pick up this folder.

But because every day there is a new file saved and its name will be different every day 'filename_date' , i do not know how to do this.

Can anyone direct me in what to do.
Is there something i can do with the settings on the FTP tool on SSIS.
I'm using SQL SERVER 2005.

thank you
0
Comment
Question by:Putoch
3 Comments
 
LVL 8

Assisted Solution

by:Som Tripathi
Som Tripathi earned 250 total points
ID: 34980407
I assume that you can use unc path such as - (\\servername\d$\file_path\) or some kind of share to the location where you are doing FTP.

Create a Batch file with below parameter -
::::::::::::::::::::::::::::::::::
@echo off
@dir /b "%1"\*.%2 /od > file.txt
@for /F %%A in ('cat file.txt') do set var=%%A
@echo %var%
copy %1\%var% %3
::::::::::::::::::::::::::::::::::

Now this batch file will take three parameters -
1. Path
2. File-Pattern
3. Target location

For example -
copy_file.bat \\servername\d$\path *.txt d:\target_path
The above will copy the latest file to the target path.
Add this in your SSIS.

The above solution might not be suitable if you are copying files from UNIX or Linux server.
0
 
LVL 16

Accepted Solution

by:
AlexPace earned 250 total points
ID: 34980597
You could automate the download with Robo-FTP like this:
FTPLOGON "ftp.mydomain.com" /user="myusername" /pw="mypassword"
GETSITEFILE "*.csv" /newest
RCVFILE %sitefile
FTPLOGOFF
EXIT

Open in new window

You could either save that as a command script and then execute it with a command line or you could create an instance of the Robo-FTP COM object and just feed it the commands one at a time.
0
 

Author Comment

by:Putoch
ID: 34980691
Thank you both,
I'm not familar with either of the processes that you mentioned above.
Sommervile, you say to create a batch file, where can i do this on the SSIS tool
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question