executing *.bat file on windows from Unix box via ftp command

I have created get_list.bat file containing following line:
dir /B /O-d >file_list.txt

I am executing ftp command from Unix box and transferring get_list.bat file to windows server.

In my next ftp command I am trying to execute this test.bat file by entering this line:
get_list
or by entering this: get_list.bat - neither works.

Please advise what I am doing wrong.

Thank you very much

get_list is not an ftp command. ftp transfers files. It can't run programs or scripts.

yes, but I am able to run let's say dir command via ftp session I thought I'd be able to kick off *.bat file on windows side while connecting via ftp command - this is not correct ?

-thanks

You can ftp to a unix box. Note that unix does not have a dir. But the ftp dir command works anyway. Unix does have a get command, but when you ftp to unix and run an get command in the ftp session, it has nothing to do with the unix get command. Windows/Dos does not have a get command. Neither os has a put command. But inside ftp, dir, get, put...they all work with both os's. And they work on all os's that support ftp. You can even ftp to some devices that do not really have any commands at all. So no, you are running remote commands in the sense that you think. If you were, it would be a horrible security problem.

I see what you're saying...
Here's the thing - I need to connect from Unix box to windows box and get latest *.txt file from some remote directory (there might be multiple *.txt files in this directory). I have no way of knowing what the latest file is since ftp does not support any of the dir or ls options such as dir /O-d or ls -lt. If i get all *.txt files form remote windows box they loose their time stamps during the transfer and I still can't find out which latest file.
If you can advise anything I'd appreciate it.

-thanks

You are painted into a corner here. What you want to do is very hard at best and in, some cases, impossible. Some more work needs to be done on the windows system to give you some way of more easily identifying the file you need. However, you can manually look at the output of dir. When you do, can you see which file to get? Bear in mind that, on unix, for old files you get "year" replacing the timestamp. Choosing the newer of two different 1-year old files would not be possible. If you can pick out the file that is needed, so can a very clever script. But be warned, this is not a piece of cake and it is not a job for a beginning script writer. If you want to go down that path, you might be able to get some ideas from: HardFeed a recursive ftp script.

There is also the possibility that you might be able to do what you want using smbclient from samba.

Perhaps consider using rsync.

Two problem with that. First, if 10,000 new files arrived, he does not want 9,999 of them. He only wants the latest one.

But the other thing is, is there a version of rsync that runs under windows/dos? Even if there is, what tcp/ip protocol could be used to support it? I have never seen rsync running between windows and unix. I would be interested to know if someone is doing this.

Just a thought on that last, can you run rsync cygwin? I don't know the answer myself and I really don't have enough interest to go looking.