Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move file from one directory to another within same FTP using jmeter

Tags:

jmeter

I am using SSH SFTP Sampler for sftp testing in jmeter. I am able to get/Put files from Ftp location to local location and vice versa. But I am not able to move file form one directory to another in same FTP location.

Please suggest.

like image 977
Prajakta Waje Avatar asked Nov 02 '25 23:11

Prajakta Waje


1 Answers

I would suggest using Beanshell Sampler and Apache Commons FTPClient for this.

FTPClient has rename(from, to) method which can be used for moving files around your FTP server.

Example code:

import org.apache.commons.net.ftp.FTPClient;

FTPClient client = new FTPClient();
client.connect("your FTP server address");
client.login("username", "password");   

client.rename("folder1/file1.txt", "folder2/file1.txt");
client.logout();
client.disconnect();

For more information on enhancing your test with scripting check out How to Use BeanShell: JMeter's Favorite Built-in Component guide.

like image 115
Dmitri T Avatar answered Nov 04 '25 21:11

Dmitri T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!