ftp to winscp script conversion problem

Advertisement

Levievre
Guest

ftp to winscp script conversion problem

Hello,

I would like to subsitute microsoft ftp with winscp but can't achieve to put a file on a server.


Here is myscript.txt file :

open ftp://username:password@ftp.example.com/
cd /archive
put -transfer=ascii myfile.txt
exit

I use a computer under windows XP, launch cmd.exe and then type the following command :
winscp.com /script=myscript.txt /ini=nul /log=mylogfile.txt

Could you tell me what is wrong with my script ?

Thank you,
Levievre from France.

Reply with quote

Advertisement

Levievre
Guest

I have no errors in the log file.

I did some searches and found a solution in a another topic :

I added an ls command between put and exit and then it works.

But I have another problem. I can't convert this command to winscp correctly :

get -transfer=ascii myfile.txt c:rename.txt

It works but I get myfile.txt in my local directory instead of rename.txt

Thank you for tour help.

Reply with quote

Levievre
Guest

Jrp78,

I need to upload a file with a new name in my local directory but I don't want to rename the file in the remote directory.

Do you think I can use the mv command for this purpose ?

Reply with quote

Advertisement

Guest

Ahh, I'm not sure on renaming local. However, I will say if you are using windows batch file to call the script in the first place, why not just use the DOS ren command right after the script is done?

winscp.com /script=myscript.txt /ini=nul /log=mylogfile.txt
cd filedirectory
ren myfile.txt newname.txt

Reply with quote

Levievre
Guest

I was thinking about this solution. i can create a batch file to delete the newname.txt file if already exists then renaming the uploaded file to newname.txt.

Since I have to execute first Winscp.com then launch the batch file, this is a long path when comparing this solution with my original microsoft ftp command.

Reply with quote

jrp78

I was thinking you would put both winscp.com and the other commands all in one batch file. That's how I run my winscp.com script with other dos commands after that fact.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: ftp to winscp script conversion problem

I added an ls command between put and exit and then it works.
This does not make sense. How can this help?

get -transfer=ascii myfile.txt c:rename.txt
You are missing a slash. Use c:\rename.txt.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum