Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Jerrys

Thank you! I'll take a look at PuTTY.
martin

For this simple task you may try using plink from PuTTY package instead. It allows you to execute a shell command on remote machine. This way you can use formatting capabilities of unix ls command (e.g. to display names only)
plink <user>:<host> -pw <password> ls > file.txt


See also https://winscp.net/eng/docs/script_custom_listing_format_csv
JerryS

I am on an Windows workstation and talking to a Linux remote server.

Basically, I set up a script file called "dolist.txt" containing the WINSCP commands that would list the contents of the all the directories on the remote server that I needed. Sort of like this:
ls ../usr/Current/Acrobat/
ls ../usr/Current/ASCII/
ls ../usr/Current/CSV/
exit

Then I started WinSCP like this:
winscp.com <root>:<password>@<ipaddress> /script=dolist.txt > file.txt

(Make sure that you have winscp.com in your search path ... it's easier that way)

Anyway, that put the entire output from all the ls commands into one file (file.txt)

It's not the nicest answer, but at least it got what I needed (for now).

I hope this helps you.
JerryS
sp

Collect list of filenames from remote directory

Hi Jerrys, i would like to get the list of filenames from remote directory in a text file. How do you manage to solve this issue?
Jerrys

Never mind, I figured out how to do it from the command line when I call WinSCP.com (I had assumed that I would have to do it from within the session).

And sorry for posting in the wrong forum ...
Jerrys

Sorry ... I forgot to mention that I am using WinSCP 4.16 with the SCP protocol in a scripting file at the command prompt in Windows. The remote computer runs Linux.
Jerrys

Collect list of filenames from remote directory

Please forgive me is this has been asked before (I am new to this).

Using the ls command to list the files in a remote directory is easy enough. But what I would like to do it to redirect the output of this command to a disk file in the local directory (Windows). In essence, I am just trying to get a list of the files in the remote directory to use for other purposes.

I have looked through the documentation, but I don't see anything that addresses redirection like this.

Any suggestions?

Thank you!
Jerry