Topic "Command line or Batch file Script for new files in last day"

Author Message
[View user's profile]

Joined: 2016-10-19
Posts: 1
Location: TN
I have configured the console to connect to a site and it will transfer files.
I need to automate this so it can be done via a scheduled task in Windows.
The command I am using successfully connects to the remote server, and attempts to download, but the log shows "Missing parameter for command 'get'."

What I am attempting to do is get files changed / created in the last day and download them to a folder on C:

The commands I'm using are:
open sftp://remotesite -hostkey="ssh..."
get -filemask="/Users/RFTP772/*>=1D"

I have also tried:
open sftp://remotesite -hostkey="ssh..."
get -filemask=/Users/RFTP772/"*>=1D", "C:\upload\extracts"

open sftp://remotesite -hostkey="ssh..."
get -filemask=/Users/RFTP772/"*>=1D C:\upload\extracts"

Every time I issue any of those commands I get in the log file:
"Missing parameter for command 'get'."

I have looked a lot in the forums, but do not know how to get past this. I am very familiar with scripting, but not with WinSCP. As I am not familiar with WinSCP script, could someone give me the exact command to get all files changed in the last day and put them in C:\upload\extract

I have tried saving the options from the console session, but it doesn't have the get commands, so I don't know how to pull down the files and put them in the folder I need them to go into. The console "generate" does not have the commands to get and save the files, though that is in the console. Is there a way to get the "generate" to show the commands needed?

I did notice there are significant differences between the "script" and "batch" commands when I generate the script. I am creating a batch file to pull the files, and will use a scheduled task to call that batch file.

Thanks to all.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27083
Location: Prague, Czechia
You want this:

get /Users/RFTP772/*>=1D

If you need to download even files in subfolders, then you need the -filemask:

get /Users/RFTP772/* -filemask=*>=1D
Martin Prikryl

Thanks! That did it.
I did find I had to put the "\" at the end of extracts, that was the only thing I had to change, other than your change.

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License