Post a reply

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

martin

Re: getting the remote directory listing into a local file

You cannot redirect an individual script commands to a file. You can:
– Redirect whole WinSCP output to a file: winscp.com /command ... > out.txt
– Redirect remote command to a remote file and download it: call ls > out.txt and get out.txt
– Enable XML logging and parse the listing out of the XML log:
https://winscp.net/eng/docs/logging_xml

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

Getting the remote directory listing into a local file

Suppose I login with this
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command "option batch abort" "option confirm off" "open sftp://UserName:Password@site.sftpSite.com"

what next command can get the directory into a local file
winscp>dir e:\data\dir.txt

or
winscp>dir > e:\data\dir.txt

or, can it be something like this
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command "option batch abort" "option confirm off" "open sftp://UserName:Password@site.sftpSite.com" "cd \OUT" "dir e:\data\dir.txt"

Should it be /console or /command