Ftp Driver in Eras
FTP (File Transfer Protocol) is a standard network protocol used to transfer files between computers on a network. In the context of RPA (Robotic Process Automation), FTP is often used to automate file transfer and management tasks, such as downloading and uploading files, organizing files into folders, and deleting files.
Here are some common FTP operations in RPA:
File Download: This involves automatically downloading files from an FTP server to the RPA system's local storage.
File Upload: This involves automatically uploading files from the RPA system's local storage to an FTP server.
File Management: This involves automatically organizing files into folders on an FTP server, such as creating new folders, moving files between folders, and deleting files.
File Synchronization: This involves automatically synchronizing files between the RPA system's local storage and an FTP server, such as copying new files from the local storage to the FTP server and updating existing files on the FTP server.
File Monitoring: This involves automatically monitoring an FTP server for changes, such as new files being added or existing files being modified, and triggering actions in response to those changes.
SetVariables
This method allows users to set Ftp server variables.
Parameters
- host -
string= Ftp server host address - username -
string= authentication username - password -
string= authentication password - port -
int= ftp server port number (default is 22)
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
GetFileContent
This method allows users to get file content in ftp.
Parameters
- filePath -
string= Folder where the file will be created
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
var fileContent = Ftp.GetFileContent("/test/20230101.csv")
InfoLog (fileContent);
UploadFile
This method is used for uploading a file to FTP server.
Parameters
- localFilePath -
string= Path of the local file name that will be uploaded. - ftpFilePath -
string= Path of the remote file name for uploaded files. - canOverride -
bool= Overwrite if there is a file or folder with same name. (default is true)
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
Ftp.UploadFile ("D:\\test.csv", "/test/20230101.csv", true);
DownloadFile
This method is used for downloading a file in FTP server.
Parameters
- remoteFilePath -
string= Path of the remote file name that will be downloaded. - localDirectory -
string= Path of the local file directory for downloaded files. - fileName -
string= name of file
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
Ftp.DownloadFile (, "/test/20230101.csv", "D:\\Eras\\", "test.csv");
DeleteFile
This method is used for deleting a file or folder in FTP server.
Parameters
- fileName -
string= File name with path.
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
Ftp.DeleteFile ("/test/20230101.csv");
IsFileExists
This method is used for checking if a file exists or not in FTP server.
Parameters
- remoteFilePath -
string= Path of the remote file - fileName -
string= File name
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
var result = Ftp.IsFileExists ("/test/","20230101.csv");
IsDirectoryExists
This method is used for checking if a directory exists or not in FTP server.
Parameters
- remoteFilePath -
string= Path of the remote file
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
var result = Ftp.IsDirectoryExists ("/test/");
ListFiles
This method is used for listing the file names in specified location.
Parameters
- remoteFilePath -
string= Directory name with path. - fileExtension -
string= specific file extension
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
var result = Ftp.IsDirectoryExists ("/test/", "txt");
MoveFile
This method is used for moving file to other directory
Parameters
- destinationDirectoryPath -
string= Destination directory name with path. - currentFilePath -
string= file which will be moved
Ftp.SetVariables("http:\\185.10.1.121", "eras", "pass123!", 22);
Ftp.MoveFile ("/test12/", "/test/2023.txt");