Avatar of Rita Byrne
Rita Byrne
Flag for Ireland asked on

How do I redirect output from psftp command

I created a file (contents below) via tsql stored procedure and ran it via ftp -s:

open server_ip
cd /itadmin/PostIngres/Billpay/
verbose off
ls EUWCC* D:\Integra\BILLPAY\WORKING\ftp_file_list.dat

I need to do the same except using sftp so I downloaded putty sftp (called via psftp on command line) - however I can't redirect the out to a file on the server like in ftp  "ls EUWCC* D:\Integra\BILLPAY\WORKING\ftp_file_list.dat" and when I use ls or dir in psftp I get

drwxr-x--- 2 ftpadmin ftpadmin        0 May 17 13:31 .
drwxr-x--- 2 ftpadmin ftpadmin        0 May 15 10:11 ..
-rwxr-x--- 1 ftpadmin ftpadmin    21018 May 17 13:31 EUCO213110501.DAT
-rwxr-x--- 1 ftpadmin ftpadmin    11779 May 17 13:21 EUWEX.DAT
-rwxr-x--- 1 ftpadmin ftpadmin        0 May 15 11:43 This is wexccuser

instead of just the file names?
Microsoft SQL ServerMicrosoft SQL Server 2005SSH / Telnet Software

Avatar of undefined
Last Comment
Rita Byrne

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Sudeep Sharma

>>>ls EUWCC* D:\Integra\BILLPAY\WORKING\ftp_file_list.dat

Try this instead:
ls -1 EUWCC* D:\Integra\BILLPAY\WORKING\ftp_file_list.dat
Rita Byrne

No not looking for a log of what happened, ls-1 is not a valid command

What I'm trying to do is get a clean listing of the files and redirect this output to a file on the my server over psftp (or some other way of connecting via sftp).
Rita Byrne

not quiet what I'm after but close
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes