Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

679 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