Re: Source file is moving to remote server directory, but content of the file is not exactly the same
I'm not sure I follow. Anyway, what I see in your batch file: You are uploading all
Regarding the archive folder: Why do you think your script should copy the file to an archive folder? I do not see any attempt to do that in your code.
Note that your generate WinSCP script file misses
See https://winscp.net/eng/docs/executables
*.txt
files from %SFTP_HOME%\scripts\agency\office\hr\out
folder to the server. At the same time you are generating a WinSCP script file sample.txt
in the same folder. So in the end your WinSCP script is uploading itself to the server. That is possibly the problem you are facing. If you do not want that, do not create the script in the %SFTP_HOME%\scripts\agency\office\hr\out
folder (or do not give it .txt
extension). Actually, your script file is not even dynamic, so there's no need to generate it on the fly in the batch file. You can use fixed pre-made script file.
Regarding the archive folder: Why do you think your script should copy the file to an archive folder? I do not see any attempt to do that in your code.
Note that your generate WinSCP script file misses
exit
command. So the WinSCP.exe
process will never finish. Also, in a batch file, you should use WinSCP.com
, not WinSCP.exe
.
See https://winscp.net/eng/docs/executables