how to save ls output to log file

Advertisement

damian
Guest

how to save ls output to log file

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

Reply with quote

Advertisement

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
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

Reply with quote

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

Reply with quote

Advertisement

You can post new topics in this forum