Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Help with scripting a file from computer to server daily

As implied by my previous answer, you cannot implement this (selecting N latest files) using a simple scripting. Scripting can select one latest file only.
creinemann

Re: Help with scripting a file from computer to server daily

I was able to come up with this using Windows Task Scheduler
/log="C:\Users\yourwinuser\Documents\WinSCP.log" /ini=nul /command "open ftp://USERNAME:PASSWORD@yourftpsite.com" "put -latest C:\Users\ yourwinuser \Downloads\MeteorImages\* /public_html/wxtoimg/" "mv public_html/wxtoimg/treated*.jpg public_html/wxtoimg/meteor.jpg" "exit"

I would like to do this for three files, would I have to add a command for each type of file to get it to upload the three most recent versions of the image? And how do I specify under the
-latest
the three most recent files?

Thanks for your suggestions

martin wrote:

For a such a complex task, you would have to use WinSCP .NET assembly, from e.g. a PowerShell script.

Start with:
https://winscp.net/eng/docs/script_upload_most_recent_file#library

But modify it to select N files:
Select-Object -First N


And then loop over the found files, like this example does:
https://stackoverflow.com/q/29787005/850848
Though you will want to upload them and you will want to change their target file name.
martin

Re: Help with scripting a file from computer to server daily

For a such a complex task, you would have to use WinSCP .NET assembly, from e.g. a PowerShell script.

Start with:
https://winscp.net/eng/docs/script_upload_most_recent_file#library

But modify it to select N files:
Select-Object -First N


And then loop over the found files, like this example does:
https://stackoverflow.com/q/29787005/850848
Though you will want to upload them and you will want to change their target file name.
creinemann

Help with scripting a file from computer to server daily

I am looking for help in generating a script that can do the following.
I have software that receives digital signals from orbiting satellites and converts them to viewable images (.jpg) the files are generated like this - UTM-2019-5-14-9-19-39-23_IR.jpg, UTM-2019-5-14-9-19-39-23_RGB_rainfall.jpg, and UTM-2019-5-14-9-19-39-23_IR.jpg By date and type of image. Typically 6-10 files per day, and automated. The Path to the file is C:\Meteor\meteorfinal\UTM filename.jpg.

What I would like to build is a script that would upload ONLY the most recent 4 or 5 files at a certain time of day, say 11:30 am local, to an ftp server I have, BUT, I would like the filenames to be changed on the server to overwrite the existing files so that my website shows only the current days images (The server files could be named like Meteor1.jpg, Meteor2.jpg, Meteor3.jpg, etc.

Is this something possible?
Any and all help needed. Example image attached.
Carl