download most recent file

Advertisement

deriol
Joined:
Posts:
2

download most recent file

Hello everyone.

I am totally new at WinScp and scripting and I am trying to automate daily download of some files.

Problem is that I only need to download most recent (i.e 1 day old file) file.

I found out that in the latest beta version of WInsCp you can put file mask with Size and Time Constraints to do that https://winscp.net/eng/docs/file_mask

However I can't manage to download only the latest excel file from the server . It keeps downloading all files.

Basically I try to do this :

winscp
open myssesion
get *.xls<1D
exit

Thx in advance.

Reply with quote

Advertisement

deriol
Joined:
Posts:
2

Re: download most recent file

martin wrote:

Should be:
get *.xls>1D

Thank you verymuch for your swift answer.

Stupid me ! And it shouldn't have any spaces as it seems.

Thanx Verymuch !

Reply with quote

PDGB
Guest

Put files on remote server < 1day old

Here is my script:

option batch abort
option confirm off
#option ignore permission

# Connect
open AvaCDX

# Upload the files
put X:\DX\Import\Bank835-test\*.*>1D /target_tx/

#Disconnect
close
# Exit WinSCP
exit

Here is the log:
. 2013-06-20 10:46:18.467 Startup conversation with host finished.
< 2013-06-20 10:46:18.467 Script: Active session: [1] AvaCDX
> 2013-06-20 10:46:18.467 Script: put X:\DX\Import\Bank835-test\*.*>1D /target_tx/
. 2013-06-20 10:46:18.467 Copying 1 files/directories to remote directory "/target_tx/"
. 2013-06-20 10:46:18.467 PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (Yes); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2013-06-20 10:46:18.467 TM: M; ClAr: No; CPS: 0; ExclM(No):
. 2013-06-20 10:46:18.467 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2013-06-20 10:46:18.467 File: "X:\DX\Import\Bank835-test\*.*>1D"
* 2013-06-20 10:46:18.467 (EOSError) System Error. Code: 123.

* 2013-06-20 10:46:18.467 The filename, directory name, or volume label syntax is incorrect
. 2013-06-20 10:46:18.467 Asking user:
. 2013-06-20 10:46:18.467 File or folder 'X:\DX\Import\Bank835-test\*.*>1D' does not exist. ("System Error. Code: 123.

. 2013-06-20 10:46:18.467 The filename, directory name, or volume label syntax is incorrect")
* 2013-06-20 10:46:18.467 (EScpSkipFile) File or folder 'X:\DX\Import\Bank835-test\*.*>1D' does not exist.
* 2013-06-20 10:46:18.467 System Error. Code: 123.
* 2013-06-20 10:46:18.467 The filename, directory name, or volume label syntax is incorrect
. 2013-06-20 10:46:18.467 Script: Failed
. 2013-06-20 10:46:18.467 Script: Exit code: 1
. 2013-06-20 10:46:18.467 Closing connection.
. 2013-06-20 10:46:18.467 Sending special code: 12
. 2013-06-20 10:46:18.467 Sent EOF message



There is 1 file that is < 1 day old in that Source directory. I can copy that file manually with the GUI (no masking).

Any help would be appreciated!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Put files on remote server < 1day old

PDGB wrote:

Here is my script:

...

There is 1 file that is < 1 day old in that Source directory. I can copy that file manually with the GUI (no masking).
What version of WinSCP are you using? Make sure you have the latest.

Reply with quote

Advertisement

You can post new topics in this forum