From: Tom on
Bob,

I tried out your code. I am trying to put a file in my PC to a FTP site. The code creates the file in the FTP with the same name and format but has no content. Please help me.

Thanks in advance.

Regards,
Tom



Henrik Staun Poulsen wrote:

Hi Bob,I'm glad it worked.Best regards,Henrik Staun Poulsenwww.stovi.
11-Aug-09

Hi Bob,

I am glad it worked.

Best regards,
Henrik Staun Poulsen
www.stovi.com


d-44d7-88f6-1f0f1dc67609(a)k1g2000yqf.googlegroups.com...

Previous Posts In This Thread:

On Tuesday, August 04, 2009 11:10 AM
Bob McClellan wrote:

xp_cmdshell copy from ftp site
I am trying to automate a daily process.
I currently download an .xml file each day then
run a sp that shreds and processes it into one of our DBs.

I'd like to create a job to do this.
my thought was to use xp_cmdshell to bring down the file
but my EXEC statement errors out.

EXEC xp_cmdshell 'copy ftp://pathToFtpSite/Tuesday_08042009.xml
\\MyServerIp\Data\Downloads'
GO

the output returns
"ftp:" is not a recognized device.
The syntax of the command is incorrect.

Any suggestions on how to automate this process is much appreciated.
thanks in advance,
...bob

On Tuesday, August 04, 2009 11:36 AM
Tibor Karaszi wrote:

The OS command interpreter's COPY command do not know what an FTP site is.
The OS command interpreter's COPY command do not know what an FTP site
is. Use some command-line FTP utility (should be plenty if you Google)
or perhaps the built-in FTP.EXE.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

On Tuesday, August 04, 2009 12:18 PM
Linchi Shea wrote:

And do not schedule to run the ftp exe via xp_cmdshell.
And do not schedule to run the ftp exe via xp_cmdshell. Just add a step to
exxecute it as a straight OS job step.

Linchi

"Bob McClellan" wrote:

On Tuesday, August 04, 2009 1:42 PM
Bob McClellan wrote:

Thanks Tibor.I will look for a comman line utility as you suggest.
Thanks Tibor.
I will look for a comman line utility as you suggest.

On Tuesday, August 04, 2009 1:44 PM
Bob McClellan wrote:

Thanks Linchi.I will set it up as it's own OS job step.
Thanks Linchi.
I will set it up as it is own OS job step.

On Tuesday, August 04, 2009 1:56 PM
Tibor Karaszi wrote:

Good point, Linchi....
Good point, Linchi.
.... or perhaps use an SSIS package which has FTP built-in as a task.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

On Wednesday, August 05, 2009 7:28 PM
Bob wrote:

Thanks for the reply and advice Henrik.
Thanks for the reply and advice Henrik.

This looks like it should do exactly what I need.
I will play around with this. I just need to be able to tell it
dynamically each day what file to pull down. It is always a filename with
Account# + dayOfWeek + CurrentDaysDate.
My SP easily strings this together. I am sure I can get the .bat file
to do the same.

Thanks again,
...bob

Bob,

I need to upload files to a FTP server, and I have just created a small
upload.bat file, that I get xp_cmdshell to run, after it has created
the files.

upload.bat looks like this:

ftp -s:upload.dat ftp.myOwnSite.com

upload.dat looks like this:

userid
password
binary
put myfile.txt
quit

Line 1 is the UserID for the FTP site, Line 2 is the password for this
site. Then I use the Binary FTP command, to ensure that it is treated
correctly. Then I upload (put) the file I want and finally I tell it
to quit processing.

FTP.com is a part of Windows, and is installed on all PCs.

Best regards,
Henrik Staun Poulsen
www.stovi.com

On Thursday, August 06, 2009 12:42 AM
Henrik Staun Poulsen wrote:

Bob,I need to upload files to a FTP server, and I've just created a
Bob,

I need to upload files to a FTP server, and I have just created a small
upload.bat file, that I get xp_cmdshell to run, after it has created
the files.

upload.bat looks like this:

ftp -s:upload.dat ftp.myOwnSite.com

upload.dat looks like this:

userid
password
binary
put myfile.txt
quit

Line 1 is the UserID for the FTP site, Line 2 is the password for this
site. Then I use the Binary FTP command, to ensure that it is treated
correctly. Then I upload (put) the file I want and finally I tell it
to quit processing.

FTP.com is a part of Windows, and is installed on all PCs.

Best regards,
Henrik Staun Poulsen
www.stovi.com

On Friday, August 07, 2009 4:41 PM
Bob McClellan wrote:

Henrik,I got the batch file working. Thanks again for this advice,..
Henrik,
I got the batch file working. Thanks again for this advice,
...bob

Bob,

I need to upload files to a FTP server, and I have just created a small
upload.bat file, that I get xp_cmdshell to run, after it has created
the files.

upload.bat looks like this:

ftp -s:upload.dat ftp.myOwnSite.com

upload.dat looks like this:

userid
password
binary
put myfile.txt
quit

Line 1 is the UserID for the FTP site, Line 2 is the password for this
site. Then I use the Binary FTP command, to ensure that it is treated
correctly. Then I upload (put) the file I want and finally I tell it
to quit processing.

FTP.com is a part of Windows, and is installed on all PCs.

Best regards,
Henrik Staun Poulsen
www.stovi.com

On Tuesday, August 11, 2009 6:13 AM
Henrik Staun Poulsen wrote:

Hi Bob,I'm glad it worked.Best regards,Henrik Staun Poulsenwww.stovi.
Hi Bob,

I am glad it worked.

Best regards,
Henrik Staun Poulsen
www.stovi.com


d-44d7-88f6-1f0f1dc67609(a)k1g2000yqf.googlegroups.com...


Submitted via EggHeadCafe - Software Developer Portal of Choice
Store ASP.NET Site Visitor Stats in MongoDb
http://www.eggheadcafe.com/tutorials/aspnet/3a73c6de-82a1-4690-a7aa-d0eda58203f7/store-aspnet-site-visitor-stats-in-mongodb.aspx
From: John Bell on
Hi

This is not really a great deal of detail to go on. My guess is that
file is somehow open by some process that creates it and not available
at the point you want to FTP it... but that is a pure guess.

Can you run you command manually from a command prompt and see what
happens?

If that works can you run the script using xp_cmdshell?

If that works can you use INSERT... EXEC to capture anything output by
xm_cmdshell in a table.

John


On Wed, 21 Jul 2010 14:02:45 -0700, Tom Cruise wrote:

>Bob,
>
>I tried out your code. I am trying to put a file in my PC to a FTP site. The code creates the file in the FTP with the same name and format but has no content. Please help me.
>
>Thanks in advance.
>
>Regards,
>Tom
>
>
>
>Henrik Staun Poulsen wrote:
>
>Hi Bob,I'm glad it worked.Best regards,Henrik Staun Poulsenwww.stovi.
>11-Aug-09
>
>Hi Bob,
>
>I am glad it worked.
>
>Best regards,
>Henrik Staun Poulsen
>www.stovi.com
>
>
>d-44d7-88f6-1f0f1dc67609(a)k1g2000yqf.googlegroups.com...
>
>Previous Posts In This Thread:
>
>On Tuesday, August 04, 2009 11:10 AM
>Bob McClellan wrote:
>
>xp_cmdshell copy from ftp site
>I am trying to automate a daily process.
>I currently download an .xml file each day then
>run a sp that shreds and processes it into one of our DBs.
>
>I'd like to create a job to do this.
>my thought was to use xp_cmdshell to bring down the file
>but my EXEC statement errors out.
>
>EXEC xp_cmdshell 'copy ftp://pathToFtpSite/Tuesday_08042009.xml
>\\MyServerIp\Data\Downloads'
>GO
>
>the output returns
>"ftp:" is not a recognized device.
>The syntax of the command is incorrect.
>
>Any suggestions on how to automate this process is much appreciated.
>thanks in advance,
>..bob
>
>On Tuesday, August 04, 2009 11:36 AM
>Tibor Karaszi wrote:
>
>The OS command interpreter's COPY command do not know what an FTP site is.
>The OS command interpreter's COPY command do not know what an FTP site
>is. Use some command-line FTP utility (should be plenty if you Google)
>or perhaps the built-in FTP.EXE.
>
>--
>Tibor Karaszi, SQL Server MVP
>http://www.karaszi.com/sqlserver/default.asp
>http://sqlblog.com/blogs/tibor_karaszi
>
>On Tuesday, August 04, 2009 12:18 PM
>Linchi Shea wrote:
>
>And do not schedule to run the ftp exe via xp_cmdshell.
>And do not schedule to run the ftp exe via xp_cmdshell. Just add a step to
>exxecute it as a straight OS job step.
>
>Linchi
>
>"Bob McClellan" wrote:
>
>On Tuesday, August 04, 2009 1:42 PM
>Bob McClellan wrote:
>
>Thanks Tibor.I will look for a comman line utility as you suggest.
>Thanks Tibor.
>I will look for a comman line utility as you suggest.
>
>On Tuesday, August 04, 2009 1:44 PM
>Bob McClellan wrote:
>
>Thanks Linchi.I will set it up as it's own OS job step.
>Thanks Linchi.
>I will set it up as it is own OS job step.
>
>On Tuesday, August 04, 2009 1:56 PM
>Tibor Karaszi wrote:
>
>Good point, Linchi....
>Good point, Linchi.
>... or perhaps use an SSIS package which has FTP built-in as a task.
 | 
Pages: 1
Prev: String quotes and variales
Next: .net professional