Fanuc SDK documentation
Upload, download & backup files
Transfer TP programs, variable files, and backups between your PC and a Fanuc controller using FTP or CGTP.
Upload, download, and backup controller files on your Fanuc robot using FTP and CGTP.
FTP : Full file management
FTP provides complete file management: upload, download, delete, rename, and directory operations.
using UnderAutomation.Fanuc;public class FtpFileManagement{static void Main(){FanucRobot robot = new FanucRobot();ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Ftp.Enable = true;robot.Connect(parameters);/**/// Upload a TP program to the controllerrobot.Ftp.DirectFileHandling.UploadFileToController(@"C:\Programs\MyPrg.tp", "md:/MyPrg.tp");// Download a file from the robotrobot.Ftp.DirectFileHandling.DownloadFileFromController(@"C:\Backup\Backup.va", "md:/Backup.va");// Delete a filerobot.Ftp.DirectFileHandling.DeleteFile("md:/OldProgram.tp");// List files in a directoryvar items = robot.Ftp.DirectFileHandling.GetListing("md:/");foreach (var item in items)Console.WriteLine($"{item.Name} ({item.Type})");// Create and delete directoriesrobot.Ftp.DirectFileHandling.CreateDirectory("md:/NewFolder");// Rename a filerobot.Ftp.DirectFileHandling.Rename("md:/old.tp", "md:/new.tp");// Check file existencebool exists = robot.Ftp.DirectFileHandling.FileExists("md:/MyPrg.tp");/**/}}
// Backup: list all files and downloadFtpListItem[] files = robot.Ftp.DirectFileHandling.GetListing("md:/");foreach (var file in files){robot.Ftp.DirectFileHandling.DownloadFileFromController($"backup/{file.Name}", $"md:/{file.Name}");}// Upload a .tp filerobot.Ftp.DirectFileHandling.UploadFileToController("C:/programs/MY_PROGRAM.tp", "md:/MY_PROGRAM.tp");// Download specific variable filesrobot.Ftp.DirectFileHandling.DownloadFileFromController(out byte[] numreg, "md:/numreg.va");robot.Ftp.DirectFileHandling.DownloadFileFromController(out byte[] posreg, "md:/posreg.va");// Or use convenience methodsNumregFile regs = robot.Ftp.KnownVariableFiles.GetNumregFile();
CGTP : File download via HTTP
CGTP provides file listing and download through the robot's web server:
// List TP programsCgtpAsciiFileItem[] programs = robot.Cgtp.Http.ListTpPrograms();// Download a file as stringstring content = robot.Cgtp.Http.DownloadAsString("numreg.va");// Download a file as bytesbyte[] data = robot.Cgtp.Http.DownloadAsBytes("posreg.va");// List files via CGTP protocolstring[] files = robot.Cgtp.ListFiles("MD:");
See also: CGTP Alarms, comments & files
Protocol comparison
| Feature | FTP | CGTP |
|---|---|---|
| Upload | Yes | No |
| Download | Yes | Yes |
| Delete | Yes | Only jobs |
| Rename | Yes | Only jobs |
| Directory ops | Yes | No |
| List files | Yes | Yes |
| Authentication | Optional | Optional |