SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help using cmd.exe to fire psftp.exe
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

warrentyler
Starting Member

USA
6 Posts

Posted - 07/26/2011 :  14:22:00  Show Profile  Reply with Quote
Hi,
I have been using a SQL Server job Step to connect to a regular FTP site. Basically I create a job step with this info:
1) Operating system (CmdExec) Step: FTP -s:K:\FTP\ftpauto1.txt
Which:
1) Opens a DOS prompt at c:\documents and settings....
2) reads FTP from the job step, then -s: (driveletter):\path\script file containing the FTP commands to connect get a files etc.

My issue with creating the job step using SQL Server job is:
When the DOS prompt opens at: c:\documents and settings....
I don't know how to tell it to:
CD to D:\ drive, cd to a directory FTP to find the PSFTP.exe and run my script file.

I need the SQL job step to do this: C:\, cd d:, d:\ cd ftp,
to end here D:\FTP.

Anyone know if I can do this in the SQL job step?

Thanks,

Chris

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 07/26/2011 :  14:34:40  Show Profile  Visit russell's Homepage  Reply with Quote
For multiple line OS commands, I'll put it in a .cmd file and have the job execute that.

By the way, you dont need the c:\, cd d:

Just go straight to D:\ftp

Edited by - russell on 07/26/2011 14:35:32
Go to Top of Page

warrentyler
Starting Member

USA
6 Posts

Posted - 07/26/2011 :  16:20:52  Show Profile  Reply with Quote
OK.

The above steps are to run a script using FTP.

My issue with the different directory etc, is getting SQL Server to fire a Putty Secure FTP command.

The Putty executable is on D:\FTP

If I run everything manually in DOS these are the successful commands:

d:
cd d:\ftp
psftp (FTP server name) -l (ID) -pw (PW) -b (The script file to run with the putty commands)


So normally in my SQL job step using regular FTP, I put :

FTP -s:K:\FTP\ftpauto1.txt

But I haven't been able to create a SQL job strp to fire Putty and the command as above.

I have tried:
d:\ftp
psftp (FTP server name) -l (ID) -pw (PW) -b (The script file to run with the putty commands)

My result file said no results were found,
I have 2 lines in the job step as opposed to just 1 above using regular FTP.

Thanks,

Chris
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 07/26/2011 :  16:29:03  Show Profile  Visit russell's Homepage  Reply with Quote
just throw it in a batch file and call the batch file from the job. one line that way
Go to Top of Page

warrentyler
Starting Member

USA
6 Posts

Posted - 08/03/2011 :  13:59:36  Show Profile  Reply with Quote
Hi Russel,

Can you put the syntax here to call the batch file?

Thanks
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 08/03/2011 :  16:09:35  Show Profile  Visit russell's Homepage  Reply with Quote
just put the location of the file in. For example:

C:\dba\batchFile.cmd
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000