[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

WINSCP synchronize alternatives?

Posted on 2009-04-20
8
Medium Priority
?
3,517 Views
Last Modified: 2013-12-09
I want to get a directory listing of a remote directory into a textfile using a WINSCP script.  I'm getting "too many parameters for ls command" message.  I've concluded that redirection is not an option.  

Will some wonderful expert please look at this and let me know how I can get a directory listing into a textfile using a WINSCP script?  Thanks.

open ftp://<user>:<pwd>@<ip address>
cd <main folder>
cd <sub folder>
ls > listoffiles.txt
get listoffiles.txt
exit

Open in new window

0
Comment
Question by:MariaHalt
  • 4
  • 4
8 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24186603
Omit the redirection operator. ls in this context takes only one parameter - the name of a local output file.
0
 

Author Comment

by:MariaHalt
ID: 24186697
Tried it, but now I'm getting these errors instead:

Error listing directory 'listoffiles.txt'
and
Could not retrieve directory listing

It's like ls can't be redirected in WINSCP.

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24187104
OK, obviously you're right. WinSCP obviously doesn't support the 'classic' FTP syntax.
The only thing which seems to work is redirecting the whole output of winscp.exe (or winscp.com) by using standard operators > or |  -
 winscp.exe .... > outfile
The headline of your Q contains 'synchronize ...'. Did you consider using the 'synchronize' facility of WinSCP? Has nothing to do with output redirection, I know ...
wmp
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MariaHalt
ID: 24187423
I removed everything to the right of the ls command and got rid of the get line too, hoping that the listing would appear in the results.txt file.

I've been running the script from a batch file that contains this line:

C:\PROGRA~1\WinSCP\winscp.exe /console /script=C:\TEMP\mywinscpscript.txt > results.txt

The file, results.txt, is empty!  

As for the synchronize command...it has its own set of problems...the remote directory is huge and the local directory is flushed daily...so what happens is all the files in the remote directory get downloaded (again and again)...some are huge and a problem inevitably occurs and the synchronization starts over...it's just not working out.  ( I meant to change that headline.)

I appreciate your help.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24187712
When it's just for the directory  listing ...
why not use the standard Windows FTP client?
 
0
 

Author Comment

by:MariaHalt
ID: 24187790
I tried that too...no luck.  ls just doesn't work like one would expect in ftp mode.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 24189042
I think winscp.exe /console opens a new window so that output redirection cannot work.
Use winscp.com instead. It provides the console interface.
wmp
 
0
 

Author Closing Comment

by:MariaHalt
ID: 31572309
.com worked!  Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the withdrawal of support for Windows Server 2003 this summer, many clients face the issue of moving away from their 2003 installs. There are a few options out there that many people/companies are selling. But the clients I have, haven't wanted…
Many of the companies I’ve worked with have embraced cloud solutions due to their desire to “get out of the datacenter business.” The ability to achieve better security and availability, and the speed with which they are able to deploy, is far grea…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question