Retrieves a remote file using GridFTP.








This command retrieves a file from a remote server using GridFTP. The user must specify the remote file location on a remote server and the local destination for the file. The user can also specify the file type. 


gd_getfile(host,remotefile,localfile) transfers the remote ASCII file remotefile from the machine host. The file is saved to the path and file specified by the string localfile


gd_getfile(host,remotefile,localfile,filetype) as above except the string filetype sets the file transfer type. When filetype = 'ASCII' the file transfer type will be ASCII (this is the default setting), alternatively when filetype = 'binary' the file transfer type is set to binary.


gd_getfile(host,remotefile,localfile,filetype,ispassive) where if ispassive is false the active FTP mode will be used, otherwise the default passive FTP mode will be used. If a passive connection cannot be established a warning is displayed and an active mode connection will be attempted.



The following command copies the file 'data2.dat' from the users home directory on the remote host 'server' to the local file 'C:\data1.dat'. The file is transferred as a binary file type.


gd_getfile('','data2.dat','C:\data1.dat', 'binary');


This example behaves as above except the file is copied from the subdirectory 'tmp' in the users home directory.


gd_getfile('','tmp/data2.dat','C:\data1.dat', 'binary');


The following example is similar to the first example except the file is copied from the subdirectory 'tmp' of the root directory on the remote machine.





A valid proxy certificate is required to use GridFTP. Suitable credentials may be required to transfer files from a remote server.


In earlier versions of this function the default FTP mode was active. The passive mode is now used by default since this is may be more appropriate when the GridFTP client is behind a firewall which blocks incoming connections.


See also

gd_putfile, gd_createproxy





Copyright © 2007, The Geodise Project, University of Southampton