Looking for Help in automating code

Looking for Help in automating code

I am new to WinSCP and scripting and was looking for some guidance on how to accomplish automating the application. My intent is to have a script that compares the remote and local directories to each other. If the folder exists on the local directory, then have the program check to see if the files in that folder on the remote directory are the same as the local one. If not, download the files from the remote directory to the local one. An Example would be