I want to rename same file every time when sending request to jmeter
we don't want to use different file each time to upload while sending request to jmeter. we just need to rename the same file everytime while sending the request
If you want to do this right before upload you can use JSR223 PreProcessor and the code like:
import org.apache.commons.io.FileUtils
import org.apache.commons.io.FilenameUtils
def file = 'test.txt'
def name = FilenameUtils.getBaseName(file)
def extension = FilenameUtils.getExtension(file)
def fileName = name + '-' + UUID.randomUUID() + '.' + extension
FileUtils.copyFile(new File(file), new File(fileName))
vars.put('fileName', fileName)
However in case of multithreading it may create huge disk IO and impact your test results so it's better to copy the file as many times as needed somewhere in setUp Thread Group, write file names to CSV file and use CSV Data Set Config in the "normal" Thread Group so each user would get the new filename on each new iteration.