Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.

705 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

21 Experts available now in Live!

Get 1:1 Help Now