psftp: get all files info in a choosen file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting psftp: get all files info in a choosen file
# 1  
Old 06-05-2012
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.
Code:
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.

Last edited by Franklin52; 06-05-2012 at 08:36 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 06-06-2012
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 )
Code:
c:\ psftp root@10.100.100.100 -pw PASSWORD -batch -b batch.psftp >qqqqq.txt

(qqqqq.txt is in the local directorty)

## batch.psftp ###
Code:
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
This User Gave Thanks to ygemici For This Post:
# 3  
Old 06-06-2012
Hello ygemici,

As simple as possible:

IT WORKS!!

Nice regards,
Ton.
# 4  
Old 06-06-2012
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.

Code:
lcd d:\sftpInfo
ls serverinfo qqqqq.txt

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


Last edited by Franklin52; 06-06-2012 at 09:49 AM.. Reason: fixed code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Is it possible to use PuTTY psftp.exe to move file from one directory to another?

Hello All, I am running a script (power shell) from my desktop (Windows). The script needs to sftp a file(using PuTTY psftp.exe ) from my desktop to a server(UNIX server). Then, as a second step, the script needs to move (or copy and delete) this file from one directory on the server (UNIX server)... (3 Replies)
Discussion started by: scampi
3 Replies

2. UNIX for Dummies Questions & Answers

PSFTP- Compare file size

Hi, I'm using PSFTP to transfer files from one machine to a virtual machine with UBUNTU OS installed on it. I'm trying to find a way to make sure the files that I'm uploading / downloading are being uploaded/ downloaded properly. I want to compare the size of the local file and the remote... (0 Replies)
Discussion started by: sessie
0 Replies

3. Windows & DOS: Issues & Discussions

PSFTP/PSCP: remotely deleting directory recursively

Hello, I'm looking for a way to use PSFTP or PSCP, executed from a batch file in Windows, to delete an entire folder and its contents. I can run a script using PSFTP which can use rm or rmdir, but the -rf command doesn't work. Any suggestions on another client to use in the same context, or a... (2 Replies)
Discussion started by: ocdcollector
2 Replies

4. Shell Programming and Scripting

Renaming files by matching info from a separate file

Hi All, I could use a bit of help with this as I'm at a loss. I have a number of files all named accordingly: I have a separate text file that is as follows: What I want to do is end up with: I don't know how to do this, though I'm certain it can be done, and would rather learn how... (14 Replies)
Discussion started by: Demosthenes
14 Replies

5. Red Hat

sshd started, but ssh/sftp/psftp not working

The OS is CenOS. The sshds is started, but ssh/sftp/psftp are not working with "time out" errors. # service sshd status openssh-daemon (pid 2894) is running... # tail /var/log/secure Feb 16 10:56:47 cenos userhelper: pam_timestamp(system-config-securitylevel:session): updated... (3 Replies)
Discussion started by: aixlover
3 Replies

6. Windows & DOS: Issues & Discussions

psftp from linux box to windows

Hi all pro I had a script from windows to put diff file from the linux box but i had stuck on it ,how to play around with the %1 @echo off "C:\putty\psftp" linux@1.1.1.1 -pw password -bc -b getfile.scr --getfile.scr lcd "C:\DATA" cd logs/ mget %1 Thanks jiajin (0 Replies)
Discussion started by: lijiajin
0 Replies

7. Shell Programming and Scripting

Not able to catch psftp errors

Hi, While running the psftp with the below code,it is able to connect and open the ftp connection and closed the connection. But my scriptfile Test.ftp,is having the code "cd directoryname" where the directoryname does not exists. In this case i should be able to catch the error,instead it is... (1 Reply)
Discussion started by: nsrihari
1 Replies

8. Shell Programming and Scripting

merging info from 2 files into 1

Hi, I have 2 files that I need to combine. I'm not sure if there is an easy way to use grep or something to combine them how i need. Basically I have 2 csv files. Each file shares an ID for a line of information, but has a bunch of other so I can't easily combine them. file1:... (2 Replies)
Discussion started by: kevin9
2 Replies

9. UNIX for Dummies Questions & Answers

instead of psftp?

psftp binary size is about to 300K and I need a smaller one. anyone suggests any idea? (4 Replies)
Discussion started by: zoque
4 Replies

10. UNIX for Dummies Questions & Answers

search command using PSFTP

I need to search (grep?) a file and send results via email. How can I do this using PSFTP? I'm VERY new and could use all the assistance anyone would be willing to provide. Currently I log in via PUTTY (HP UX) and type the following... grep FILENAME /xxx/xxxxxx>/xxx/filename_typemanualdate... (1 Reply)
Discussion started by: newbiepgrmr
1 Replies
Login or Register to Ask a Question