Topic "Input filename condition from user at beginning of script."

Author Message
crawly

Guest


I have to download a number of files on a weekly basis from a ftp. The filenames remain the same from week to week except there is a date code added to the file. eg "image22.tif", where 22 is the week number. Naturally the file next week would be called "image33.tif". Would there be a way to prompt the user at start up for the we number, in this case "22", and then merrily go off and download all the files I need. Think this would be possible?
crawly

Guest


A correction to the original post... the second file should have been named "image23.tif", not "image33.tif". Also "prompt the user at start up for the we number" should have read "prompt the user at start up for the week number".

So, aside from all that. I was going through some example scripts and one was checking the timestamp of the remote files. So how about I just get the script to calculate the current week and add it to the file name string and just like the example if it is there, download it, if not, then write that the file does not exist yet.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
WinSCP script does not support any kind of custom prompting nor calculation.

You can however prompt user from wrapping batch file and pass the answer to WinSCP script.
See http://stackoverflow.com/questions/1223721/in-windows-cmd-how-do-i-prompt-for-user-input-and-use-the-result-in-another-com

To access the entered value from the script, either store it to environment variable or pass it using /parameter switch.
See http://winscp.net/eng/docs/scripting#syntax
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License