

When specific file name is used, command fails when the file does not exist. Streaming is supported with the SFTP and FTP. With the /stdout command-line switch, - can be used as a target to stream the contents of downloaded file(s) to the standard output of. To download more files to current working directory use. Target directory must end with backslash. The last parameter specifies target local directory and optionally operation mask to store file(s) under different name. To download all files in a directory, use mask *. Filename can be replaced with wildcard to select multiple files. If more parameters are specified, all except the last one specify set of files to download. If only one parameter is specified, downloads the file to local working directory. See also WinSCP article on downloading the most recent file.Downloads one or more files from remote directory to local directory. So you let WinSCP download all files updated/created in the last 2 hours (6am – 4am): get *.txt>2h

"get ""*.txt>%%TIMESTAMP#yyyy-mm-ss%% 4:00"""Īnother solution is a static script that rely on a relative time: E.g.

When passing the get on WinSCP command-line in a batch file (using /command switch, as opposite to using /script switch to specify a separate script file), you have to double the % to avoid the batch-file trying to interpret the %TIMESTAMP%: /command. Simply, the above means, get all files created later than 4:00 today (the %TIMESTAMP#yyyy-mm-ss% resolves to today's date in format yyyy-mm-ss, as needed for the time constraint).

To dynamically inject today's date, use the %TIMESTAMP% syntax: get "*.txt>%TIMESTAMP#yyyy-mm-ss% 4:00" If not, please explain, why do you need timestamp-based solution.Īnyway, you can use a file mask with a time constraint: get "*.txt> 4:00" First, I assume your file does not have fixed name (contrary to your question with fixed name file.txt).
