psftp: get all files info in a choosen file

Dear all,

We are trying to get file information in a file from our sftp server with the program psftp.

lcd d:\sftpInfo
cd serverInfo
ls *.* > qqqqq.txt

After running the ls command, we see all files who are in the serverInfo directory on the screen. No error is showed.

Our question is:
Where can we find the qqqqq.txt file?
It isn't in the local direrectory: d:\sftpInfo
It isn't in the server directory: serverInfo

Hopefully someone knows a solution.

Nice regards,
Ton.

psftp usually used to file transfer processes..actually psftp client connects to sshd and sshd spawns the sftp-server process for that..
and you cannt use the redirection in this session, because of such a structure(no tty) does not in..

1-) "> qqqqq.txt" is invalid (ignored) expr, for this you cannt find the file
maybe try this (you may dont want to use the passwd clearly and then you can ignore and can give the passwd manually on the prompt )

c:\ psftp root@10.100.100.100 -pw PASSWORD -batch -b batch.psftp >qqqqq.txt 

(qqqqq.txt is in the local directorty)

## batch.psftp ###

cd /root/em2em
ls *.*

2-) lcd used for the local directory changes so sftpInfo folder in the local side
3-) yes it is on the remote..

regards
ygemici

1 Like

Hello ygemici,

As simple as possible:

IT WORKS!!

Nice regards,
Ton.

There are alternatives using only ftp syntax. Note that there is no ">" because the output filename is part of the ftp ls syntax. The output file is created on the local server.

lcd d:\sftpInfo
ls serverinfo qqqqq.txt
lcd d:\sftpInfo
cd serverInfo
ls *.* qqqqq.txt