Topic "how to save ls output to log file"

Author Message
damian

Guest


Hi,

I'm able to connect to my remote machine via ftp (using script file), upload some files and save this to log. However, when I try to list uploaded files using 'ls' command I only get:

> 2008-10-28 15:40:57.375 LIST -a
< 2008-10-28 15:40:57.406 150 Opening ASCII mode data connection for file list.
< 2008-10-28 15:40:57.406 226-Transfer complete.
< 2008-10-28 15:40:57.406 226 Quotas off
. 2008-10-28 15:40:57.406 Directory listing successful
. 2008-10-28 15:40:57.406 Disconnected from server

As you can see, ls does nothing at all. There is no output from this command in the log file.

I tried using call ls, but I got an error:
> 2008-10-28 15:44:43.547 ls
< 2008-10-28 15:44:43.547 500 LS not understood.
* 2008-10-28 15:44:43.547 (ExtException) LS not understood.
. 2008-10-28 15:44:43.547 Disconnected from server

Is there some other way to list uploaded files? I need this to check their sizes on the remote machine (and compare it to the ones I keep locally).

Thanks in advance
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
you can redirect output of the script to file and use ls command in the script.
_________________
Martin Prikryl
damian

Guest


@prikryl: I did. I run my program with the following parameters (using portable executable):
winscp417.exe /script=myscript.txt /log=my_log.log

myscript.txt looks like this:

option batch on
option confirm off
open ftp://user:password@ipaddress
option transfer binary
cd /some_folder/
put c:\test\*.txt
ls
close
exit

And part of my_log.txt file:
< 2008-10-28 15:40:57.375 200 PORT command successful.
> 2008-10-28 15:40:57.375 LIST -a
< 2008-10-28 15:40:57.406 150 Opening ASCII mode data connection for file list.
< 2008-10-28 15:40:57.406 226-Transfer complete.
< 2008-10-28 15:40:57.406 226 Quotas off
. 2008-10-28 15:40:57.406 Directory listing successful
. 2008-10-28 15:40:57.406 Disconnected from server
. 2008-10-28 15:44:43.422


As you can, the output is redirected to the file, but there's no way I can see listed files.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
damian wrote:
@prikryl: I did. I run my program with the following parameters (using portable executable):
winscp417.exe /script=myscript.txt /log=my_log.log

I mean redirecting output on the program like:
winscp.com /script=myscript.txt /log=my_log.log > output
_________________
Martin Prikryl
damian

Guest


I tried with "> output.txt" but didn't have winscp.com file (not available in portable executable).

Now it works great. Thank you
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License