Topic "download most recent file"

Author Message
deriol
[View user's profile]

Joined: 2012-08-30
Posts: 2
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 http://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 :

Quote:
winscp
open myssesion
get *.xls<1D
exit


Thx in advance.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Should be:
get *.xls>1D
_________________
Martin Prikryl
deriol
[View user's profile]

Joined: 2012-08-30
Posts: 2
prikryl 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 !
PDGB

Guest


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!
PDGB

Guest


The upload works fine without the >1D mask, just *.*.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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.
PDGB

Guest


It is version 4.3.8.

I'll get the latest installed soon and give it a try.

Thanks!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Time constraints were introduced in 5.0.6:
http://winscp.net/tracker/show_bug.cgi?id=672
_________________
Martin Prikryl
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