Getting the remote directory listing into a local file

Advertisement

sy27295
Joined:
Posts:
11
Location:
Boston, USA

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

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

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

Reply with quote

Advertisement

You can post new topics in this forum