getting the remote directory listing into a local file

Advertisement

sy27295
Joined:
Posts:
12
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

sy27295
Joined:
Posts:
12
Location:
Boston, USA

Re: getting directory listing of a folder - what is syntax?

NOT WORKING ..... in command line

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


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

sy27295 wrote:

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

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
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
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum