How to extract latest files

Advertisement

bkan
Guest

How to extract latest files

Good Morning All,
I'm using Winscp client to extract .txt files from a remote server to the local server on my network. I get 3 files each month and they are in the format
MCTF-201306,MCTA-201306,MCTD-20306
MCTF-201307,MCTA-201307,MCD-201307
My code is as below
option batch on
option confirm off
open sftp://<username>:<password>@server -hostkey="ssh-dss xxxxxxxxxxxxxxxx"
cd .
option transfer binary
get -preservetime *.txt F:\FTPShare\ftp\
 close
exit
My code is bringing all the .txt files instead of the latest, can anyone please guide me as to the chnages that i need to make to my code to get only the lates?
Thanks

Reply with quote

Advertisement

Guest

Thanks
so should i replace the my code with
option batch on 
option confirm off 
open sftp://<username>:<password>@server -hostkey="ssh-dss xxxxxxxxxxxxxxxx" 
cd . 
option transfer binary 
synchronize local [ <local directory> [ <remote directory> ] ]
 *.txt F:\FTPShare\ftp\ 
 close 
exit

Reply with quote

bkand
Guest

Can anyone please help me with this code?

Anonymous wrote:

Thanks
so should i replace the my code with
option batch on 
option confirm off 
open sftp://<username>:<password>@server -hostkey="ssh-dss xxxxxxxxxxxxxxxx" 
cd . 
option transfer binary 
synchronize local [ <local directory> [ <remote directory> ] ]
 *.txt F:\FTPShare\ftp\ 
 close 
exit

Reply with quote

Advertisement

You can post new topics in this forum