Topic "modify 'download most recent file' script to append file?"

Author Message
ardz
[View user's profile]

Joined: 2010-10-28
Posts: 1
been playing with this fantastic script:

http://winscp.net/eng/docs/script_download_most_recent_file

it's great! but where do I modify it so it automatically appends to a previously downloaded file? (just exits with an error by default if a previously downloaded file already exists). Cheers! Very Happy
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Add -append switch to get command. It works with SFTP protocol only though.
_________________
Martin Prikryl
sp119

Guest


I'm pretty new to scripting so bear with me on this.

I can only get so far with this script. I am able to get it to login, view the files, create the XML file but then it says "No file found" even after it lists the files. I have a mask set to locate a file that starts with a specific name, it lists all the files that start with that but then doesn't go on to actually download anything.

It appears that while it is able to list the files, it doesn't actually write them to the xml file thus the no file in the log if statement that states:

if (filenameLatest == null)
{WScript.Echo("no file found");
WScript.Quit(0);
}

takes affect and doesn't move on to the rest of the script that actually does the file downloading.

Any assistance in pointing me in the write direction would be helpful.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
What does the XML log file look like?
_________________
Martin Prikryl
sp119
[View user's profile]

Joined: 2010-12-14
Posts: 1
Location: Atlanta, GA
prikryl wrote:
What does the XML log file look like?


The first part shows the connection information, access granted etc... The bottom part looks like this:



Code:

. 2010-12-14 14:15:59.825 --------------------------------------------------------------------------
. 2010-12-14 14:15:59.825 Using SFTP protocol.
. 2010-12-14 14:15:59.825 Doing startup conversation with host.
> 2010-12-14 14:15:59.825 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2010-12-14 14:15:59.918 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2010-12-14 14:15:59.918 SFTP version 3 negotiated.
. 2010-12-14 14:15:59.918 We believe the server has signed timestamps bug
. 2010-12-14 14:15:59.918 We will use UTF-8 strings for status messages only
. 2010-12-14 14:15:59.918 Getting current directory name.
. 2010-12-14 14:15:59.918 Getting real path for '.'
> 2010-12-14 14:15:59.918 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2010-12-14 14:16:00.027 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2010-12-14 14:16:00.027 Real path is '/'
. 2010-12-14 14:16:00.027 Startup conversation with host finished.
. 2010-12-14 14:16:00.027 Listing directory "/xxxxxx".
> 2010-12-14 14:16:00.027 Type: SSH_FXP_OPENDIR, Size: 17, Number: 267
< 2010-12-14 14:16:00.215 Type: SSH_FXP_HANDLE, Size: 16, Number: 267
> 2010-12-14 14:16:00.230 Type: SSH_FXP_READDIR, Size: 16, Number: 524
< 2010-12-14 14:16:02.835 Type: SSH_FXP_NAME, Size: 9417, Number: 524
> 2010-12-14 14:16:02.835 Type: SSH_FXP_READDIR, Size: 16, Number: 780
< 2010-12-14 14:16:02.929 Type: SSH_FXP_STATUS, Size: 17, Number: 780
< 2010-12-14 14:16:02.929 Status/error code: 1
> 2010-12-14 14:16:02.929 Type: SSH_FXP_CLOSE, Size: 16, Number: 1028
. 2010-12-14 14:16:02.929 Closing connection.
. 2010-12-14 14:16:02.945 Sending special code: 12
. 2010-12-14 14:16:02.945 Sent EOF message


There appears to be an error code of 1 but I don't know what that means.

P.S. Sorry it took so long to get back to this, I've had other projects that took over my life!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
This is not XML log. Please see:
http://winscp.net/eng/docs/logging_xml
_________________
Martin Prikryl
arun-j
[View user's profile]

Joined: 2012-11-23
Posts: 3
Hi,
Im having the same issue ... my log file looks the same ....

if i try /xmllog in the commandline my log file is not written with log data Sad

pls help!!
arun-j
[View user's profile]

Joined: 2012-11-23
Posts: 3
commandline :
"c:\Program Files\WinSCP\WinSCP.exe" /script=C:\appu\testscript.txt /xmllog=C:\appu\apputest.xml
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Are you using the latest version of WinSCP?
arun-j
[View user's profile]

Joined: 2012-11-23
Posts: 3
thanks man it works now... prob was the version
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