Solved

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

Posted on 2011-02-25
3
267 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now