| Author |
Topic |
|
slugfest
Starting Member
18 Posts |
Posted - 2004-10-20 : 14:06:57
|
| I have used the FTP Task in DTS to download a single file, but how do I go about downloading multiple files from a given directory on a remote server? Specifically, I'm trying to grab all files in a dated directory and move those to my local server. Any help is appreciated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-20 : 15:32:48
|
| I wouldn't use an FTP task for this inside your DTS package. Instead, I would create a batch file that does the ftp commands that you need. Then call the batch file from within the DTS package using an Execute Process task.Tara |
 |
|
|
slugfest
Starting Member
18 Posts |
Posted - 2004-10-20 : 20:48:48
|
| T,Can you give me a bit of direction? I'm familiar with working within DTS using the assigned tasks and using some custom scripting via SQL Server tasks, but I'm not familiar with using batch files as you described.Thanks. |
 |
|
|
brandonl
Yak Posting Veteran
58 Posts |
Posted - 2004-10-20 : 21:29:57
|
quote: Originally posted by tduggan I wouldn't use an FTP task for this inside your DTS package.
How come? I use the batch file method myself, but am interested to know why not to use the one in DTS.~BrandonL |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-10-20 : 21:44:20
|
| If you go to your Windows Help file (right on the Start Menu) and look up "ftp" in the index, it will show you how the command line utility works.Probably the easiest way to download an entire FTP directory is to save the FTP commands into a file, then use the ftp -s parameter to use that file. Copy the following and save it to a file called "ftp.txt":open ftp.microsoft.comuser anonymous a@a.comcd MISCmget *.*quitThen run the following command in the same directory as that file:ftp -v -n -i -s:ftp.txtThis will connect you to Microsoft's public FTP site and download all of the files in the MISC folder. Works like a charm, and if they add or delete files you don't care, the "mget" command will get any or all of them as you like. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-10-20 : 21:46:55
|
| The DTS FTP task is not nearly as flexible or easy to use as the command line FTP is. See the example I posted. Plus, if you wanted to upload via FTP, the DTS task won't do that, but the command line will. You'd use the "put" or "mput" commands to do that. |
 |
|
|
slugfest
Starting Member
18 Posts |
Posted - 2004-10-21 : 10:06:05
|
| Thanks for the response, Rob. The reason I am trying to do this in DTS is I need this to execute daily (on a scheduled basis). Is that something I can do with the command line utility? |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2004-10-21 : 10:10:53
|
| I think the general consensus is that there's nothing wrong with using DTS for this (allowing you to schedule your package to run however you want), just use an Execute Process Task to run a batch file rather than using a DTS FTP task.Mark |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-10-21 : 10:18:14
|
| I do it from t-sql in a stored proc using the the command line exeseehttp://www.nigelrivett.net/s_ftp_PutFile.htmlDTS is nothing to do with scheduling seehttp://www.nigelrivett.net/BadThings.html- it just happens that dts comes with a wizard that will create a scheduled job containing a command line dtsrun command.The above would be a SP to schedule a call to. The other option mentioned would be a batch file which could be called via a command line call or an xp_cmdshel t-sql command.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|