1
votes

I have some file in my directory like:

request_1.txt
request_2.txt
request_11.txt
request_12.txt
response_1.txt
response_2.txt
response_11.txt
response_12.txt

I would like to delete these files before executing the JMeter scenario. I'm using OS Process Sampler and config:

  • Command: rm
  • Working directory: path/to/my/directory/
  • Command parameters: re*.txt

It didn't work. Nothing is deleted.

I tried to run the command rm re*.txt in the terminal then it works well, all files was deleted as my expected.

Note: If I change the Command parameters to specific file as request_1.txt. This file will be deleted normally.

So what am I doing wrong while using the wildcard in OS Process Sampler? Please help.

Thanks in advance!

1

1 Answers

2
votes

This is because rm command doesn't know anything about wildcards. Wildcards is one of the features of Unix shell, most likely you're using Bash

So in order to fix your issue you should be calling bash instead of rm

Example configuration:

OS Process Sampler

See How to Run External Commands and Programs Locally and Remotely from JMeter article to get more information on kicking off external processes from JMeter test scripts.