Re: Script for copy files, move if succes and create log
I'm not sure I understand your problem.
Is the problem with the first script that you want to create a simple log of successfully transferred files?
You can use XML logging and that convert that XML to any format you want.
https://winscp.net/eng/docs/logging_xml
But I'd recommend you to use WinSCP .NET assembly from a PowerShell script.
Your code would be a way more efficient and robust.
https://winscp.net/eng/docs/library_powershell
Thank you for your reply. I supposed your second link will be much better to me.
My goal is to create a script which put files to remote ftp but I want to know if a transfer was success or fail for each file. If success must save specific data to a log file and move a local file to another directory. First script is working fine but for ALL files. If connection break it start again and try to transfer ALL files again. When finish move ALL files and not possible to save a log.
Second put each file to remote server, save log but need a new ftp connection to each file in directory. If I have 100 files, 1000 files it need to create 100 connections, 1000 connections. It need a time.
The best script:
1. connect to remote ftp
2. start loop
3. put file
4. if success save log and move file to another directory
5. if error try to put again
6. end loop
7. quit
I will try to use power shell script,
Thank you.
Best regards,
Grzegorz