# Transfer scripts

Transfer Scripts

Transfer class is used to manage your transfer queue, such as start/stop processing the queue, add/remove transfer item, load/save the queue list.

Through the Transfer class, you can also directly create a transfer task to transfer file/directory from server to server, or server to local, or local to server.

For example:

Transfer.TransferFile(Site.GetServer("demo"), Site.GetServer("Test/local"), "download/Autumn.jpg", "Test/Test.jpg");

This script will transfer the the file "download/Autumn.jpg" from the "demo" site to "Test/local" site and rename it as "Test/Test.jpg".

If you want to keep the original file name, and transfer the file to the "Test" directory under the "Test/local" site, you can use script like below:

Transfer.TransferFile(Site.GetServer("demo"), Site.GetServer("Test/local"), "download/Autumn.jpg", "Test/");

You can also directly create Server object and pass it to TransferFile function.

Server source = new Server{ Host ="demo.wftpserver.com", Username="demo", Password="demo" }; Server target = new Server { Host = "192.168.1.8", Username="Test", Password="Test", Port = 22, Protocol =ServerProtocol.SFTP}; Transfer.TransferFile(source,target, "download/Autumn.jpg", "Test/");

The above scripts will transfer a jpg file from server "demo.wftpserver.com" which runs FTP service on port 21 to server "192.168.1.8" which runs

SFTP service on port 22. The default protocol of the Server object is FTP, and the default port is 21. If you use the default values, you do not need to specify them.

Server.Local represents the local computer, you can use it to transfile file/directory between the server and local computer.

Transfer.TransferFile(Site.GetServer("demo"), Server.Local, "download/Autumn.jpg", "C:/Test/");

The above script will transfer the jpg file "download/Autumn.jpg" on the "demo" site to local computer "C:/Test" directory.