This page is being updated.
Please check back soon...

Close

Examples of using product through code

FTP2SF API Example

public class Examples  {
    
    public static void SaveAttachmentsTOSF(String directory, Id objId){
    FTP2SF.FTP.Find result = FTP2SF.FTP.Find('Test', directory).items;
 
    List attachments = new   List  ();
    
    for(FTP2SF.FTP.File  file : items){
            if(!file.attrs.dir){
                Attachment a =  new Attachment ();
                a.parentId = objId;
                a.Name = file.filename;
                a.body = FTP2SF.FTP.Get('Test', file.longname);
                attachments.add(a);
            }
        }
 
        insert attachments;
    } 
    
    public static void SaveAttachmentsToFTP(Id objId){ 
        List attachments = [Select Name, Body from Attachment where parentId =: objId];
        for(Attachment a : attachments){
            FTP2SF.FTP.Put('Test', a.Name, a.Body );
        }
    }
    
    public static void RenameFile(String site, String oldPath, String newPath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.ren(site, oldPath, newPath);
    }
    
    public static void DeleteFile(String site, String filePath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.del(site, filePath);
    }
    
    public static void TransferFile (String fromSite, String fromFilePath, String toSite, String toFilePath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.trn(fromSite, fromFilePath, toSite, toFilePath);
    }
    
    public static void CreateDirectory(String site, String filePath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.mkdir(site, filePath);
    }
    
    public static void DeleteDirectory(String site, String filePath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.rmdir(site, filePath);
    }
    
    public static void FileExists(String site, String filePath){
        FTP2SF.FTP.Response result = FTP2SF.FTP.exists(site, filePath);
    }
    
    public static void AppendToFile(String site, String filePath, Blob content){
        FTP2SF.FTP.Response result = FTP2SF.FTP.append(site, filePath, content);
    }
    
    public static void RetrieveFile (String site, String filePath, String requestId, String terminator, integer maxSize){
        FTP2SF.FTP.Rtr(Site, filePath, requestId, terminator, maxSize);
    }
    
    public static void PingSite(String site, integer timeout){
        FTP2SF.FTP.Response  result = FTP2SF.FTP.Ping (site, timeout);
    }
 
}
footer-logo

If you want high performance, high availability, low operational costs we are here to help.