Solved

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

Posted on 2011-02-25
3
311 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
[X]
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
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

636 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