Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help using cmd.exe to fire psftp.exe

Author  Topic 

warrentyler
Starting Member

6 Posts

Posted - 2011-07-26 : 14:22:00
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

5072 Posts

Posted - 2011-07-26 : 14:34:40
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
Go to Top of Page

warrentyler
Starting Member

6 Posts

Posted - 2011-07-26 : 16:20:52
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

5072 Posts

Posted - 2011-07-26 : 16:29:03
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

6 Posts

Posted - 2011-08-03 : 13:59:36
Hi Russel,

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

Thanks
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-08-03 : 16:09:35
just put the location of the file in. For example:

C:\dba\batchFile.cmd
Go to Top of Page
   

- Advertisement -