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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With