SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FTPGetFile

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
FTPGetFile
Author Message
D Beer



Joined: 16 Sep 2002
Posts: 5

Post FTPGetFile Reply with quote

Hi

set ExpectedFileType, "Bname.dat;"
set FTP_Directory, "SYS$CLIENT:[DOWNLOAD.BNAME]"

//Get Directory Listing

FTPDir "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com", "Pass", FTP_Directory, filelist

After receiving the filelist fom the above directory
and locating the specific file i want to download i
make use of FTPGetFile. However after it attempts to
do this it errors with the following:

Download failed for "". The server has returned an
extended error: 200 TYPE set to IMAGE. 200 PORT command
successful.502 SIZE is unimplemented. 550-Failed to
open WEB$USER[INVESTOR]filename.; f

This directory, WEB$USER[INVESTOR], is the default
when i connect via Ftp32pro. How do i go about
getting the job to recognise the fact that it must
change directory in order to download the said
'bname.dat' file?

Thanks

DB


Mon Sep 16, 2002 11:37 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPGetFile Reply with quote

You need to pass full file name including file path to the FTPGetFile not just the file name alone

After "locating the specific file" you need to append its name to the file path,
for example

Dim Full_FTP_FileName, string
Dim Full_Local_FileName, string

ConcatEx FTP_Directory, "/", FileName, Full_FTP_FileName
ConcatEx Local_Directory, "\\", FileName, Full_Local_FileName

FTPGetfile "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com", "Pass", Full_FTP_FileName, Full_Local_FileName

: Hi

: set ExpectedFileType, "Bname.dat;"
: set FTP_Directory, "SYS$CLIENT:[DOWNLOAD.BNAME]"

: //Get Directory Listing

: FTPDir "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com",
: "Pass", FTP_Directory, filelist

: After receiving the filelist fom the above directory
: and locating the specific file i want to download i
: make use of FTPGetFile. However after it attempts to
: do this it errors with the following: Download failed for "". The
: server has returned an
: extended error: 200 TYPE set to IMAGE. 200 PORT command
: successful.502 SIZE is unimplemented. 550-Failed to
: open WEB$USER[INVESTOR]filename.; f

: This directory, WEB$USER[INVESTOR], is the default
: when i connect via Ftp32pro. How do i go about
: getting the job to recognise the fact that it must
: change directory in order to download the said
: 'bname.dat' file?

: Thanks

: DB

Mon Sep 16, 2002 11:50 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPGetFile Reply with quote

By the way why do you call FTPDir if you know name of the file to be downloaded?
FTPDir does not change the remote directory it only returns the list of files fro mthe specified directory.

All you need to do is to code a single line job like the following:

FTPGetfile "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com",
"Pass", "real_dir_name_here/bname.dat", "c:\\download\\bdata.dat"

That's it!

: You need to pass full file name including file path to the FTPGetFile not
: just the file name alone

: After "locating the specific file" you need to append its name to
: the file path,
: for example

: Dim Full_FTP_FileName, string
: Dim Full_Local_FileName, string

: ConcatEx FTP_Directory, "/", FileName, Full_FTP_FileName
: ConcatEx Local_Directory, "\\", FileName, Full_Local_FileName

: FTPGetfile "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com",
: "Pass", Full_FTP_FileName, Full_Local_FileName

Mon Sep 16, 2002 11:58 am View user's profile Send private message
D Beer



Joined: 16 Sep 2002
Posts: 5

Post Re: FTPGetFile Reply with quote

: By the way why do you call FTPDir if you know name of the file to be
: downloaded?
: FTPDir does not change the remote directory it only returns the list of files
: fro mthe specified directory.

: All you need to do is to code a single line job like the following:
: FTPGetfile "xxx.xx.197.137", "xxx@@xxxx.xxxxx.com",
: "Pass", "real_dir_name_here/bname.dat",
: "c:\\download\\bdata.dat"

: That's it!

Its done using FTPDir as the job is designed to look
for the most current version of the file as there can
sometimes be more than one file with the same name.

As to your answer:

I have this FTPGetFile at the end of the script which is where the error is occurring.
The lines you state are similiar: I have

ConcatEx FTP_Directory, TargetFilename, TargetPathAndFilename

Set DestinationFilenameBuffer, Targetfilename

GetToken ";", DetinationFilenameBuffer, DestinationFilename

ConcatEx "my:\\destination\\folder\\", DestinationFilename, DestinationPathAndFilename

FTPGetFile("xxx.xx.197.137", "xxx@@xxxx.xxxxx.com", "Pass", "TargetPathAndFilename", "DestinationPathAndFilename")

All works fine in de-bug mode upto actual ftp'ing of file.

DB


Mon Sep 16, 2002 12:36 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPGetFile Reply with quote

Understood.

What is the value of TargetPathAndFilename? Does it contain commas as part of the file name?

: Its done using FTPDir as the job is designed to look
: for the most current version of the file as there can
: sometimes be more than one file with the same name.

: As to your answer: I have this FTPGetFile at the end of the script which is
: where the error is occurring.
: The lines you state are similiar: I have

: ConcatEx FTP_Directory, TargetFilename, TargetPathAndFilename

: Set DestinationFilenameBuffer, Targetfilename

: GetToken ";", DetinationFilenameBuffer, DestinationFilename

: ConcatEx "my:\\destination\\folder\\", DestinationFilename,
: DestinationPathAndFilename

: FTPGetFile("xxx.xx.197.137", "xxx@@xxxx.xxxxx.com",
: "Pass", "TargetPathAndFilename",
: "DestinationPathAndFilename")

: All works fine in de-bug mode upto actual ftp'ing of file.

: DB

Mon Sep 16, 2002 1:30 pm View user's profile Send private message
D Beer



Joined: 16 Sep 2002
Posts: 5

Post Re: FTPGetFile Reply with quote

: Understood.

: What is the value of TargetPathAndFilename? Does it contain commas as part of
: the file name?

not a comma but a semicolon

It returns:

"Sys$Client:[Download.Bname]Bname.dat;2415"

Tue Sep 17, 2002 8:20 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPGetFile Reply with quote

What 2415 is for? File version number?

Does FTPDir return it as a part of the file name?

: not a comma but a semicolon

: It returns: "Sys$Client:[Download.Bname]Bname.dat;2415"

Tue Sep 17, 2002 10:19 am View user's profile Send private message
D Beer



Joined: 16 Sep 2002
Posts: 5

Post Re: FTPGetFile Reply with quote

: What 2415 is for? File version number?

: Does FTPDir return it as a part of the file name?

2415 is the version number.

FTPDir returns it as part of the filename. View the full job.

Full filename: BNAME.DAT;2415 19/24 16-SEP-2002 18:36:29 [PROD,SDPRICE] (RWED,RWED,RE,RE)

Dim FTP_Directory string
Dim ExpectedFileType string
Dim Filelist String
Dim Isempty Boolean
Dim CharstoRemove number
Dim FilelistisEmpty boolean
Dim FiletypeIsCorrect boolean
Dim Filetype String
Dim Filename String
Dim TargetFilename string
Dim TargetPathAndFilename string
Dim DestinationFilenameBuffer string
Dim DestinationFileName string
Dim DestinationPathAndFilename string

//Download Bname.dat file from ftp site

set FTP_Directory, "SYS$CLIENT:[Download.Bname]"
set ExpectedFileType, "BNAME.DAT;"

//Fet directory Listing

FtpDir "xxx.xx.197.137", " xxxx@@xxx.xxxx.com" ,"Pass", FTP_Directory, filelist

// Remove characters from begining of filelist: need to remove 11 plus the length of FTP_Directory

Length (FTP_Directory, CharsToRemove)

Add (11, CharsToRemove, CharsToRemove)

Replace filelist, 1, CharsToRemove, "", filelist

START_MAIN_LOOP:

IsEqual Filelist, "", FilelistIsEmpty

If (FilelistIsEmpty, COMPLETED_PROCESSING_FILELIST, PROCESS_NEXT_FILENAME)

PROCESS_NEXT_FILENAME:

GetToken "),", filelist, filename

Left filename, 24, filename

Trim filename, filename

Mid filename 1, 10, filetype

//Lower filetype, filetype

IsEqual filetype, ExpectedFiletype, FileTypeIsCorrect

If ( FileTypeIsCorrect, completed_processing_filelist, START_MAIN_LOOP )

COMPLETED_PROCESSING_FILELIST:

set (TargetFileName, filename)

//FTPConfig ( "Transfer Mode", "ASCII" )

//Ftp file to directory

ConcatEx FTP_Directory, TargetFilename, TargetPathAndFilename

Set DestinationFilenameBuffer, TargetFilename

GetToken ";", DestinationFilenameBuffer, DestinationFilename

ConcatEx "r:\\my\\folder\\current\\", DestinationFilename, DestinationPathAndFilename

FTPGetFile( "xxx.xxx.xxx.137", "xxxx@@xxx.xxxx.com", "Pass", "TargetPathAndFilename", "DestinationPathAndFilename" )

//Send confirmation of success

MailSend( "Scheduler", " ", "e-mail", "Success: bname.dat file", "The bname.dat file downloaded succesfully" )

Exit

As mentioned at login, via FTPpro, the directory defaults to WEB$USER[INVESTOR].
Could this be a factor why it cannot change directory. While on the ftp site i must manually type in the new directory i want to goto.
i.e SYS$CLIENT:[Download.Bname]

Tue Sep 17, 2002 11:57 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.