powershelljmeterfile-renameepoch

How to get/read moved file name in Jmeter from OS Process Sampler response


Vis OS Process Sampler in Jmeter. I am renaming one file with epoch and then moving that file to another location. Operating system: Windows 10 tool to perform operations: PowerShell

i.e. TestFile.docx to TestFile_2008202416202205.docx

I want name of that file to upload it somewhere via jmeter HTTP request which requires file name as a parameter.

how can I take name of that file?

In response of OS Process sampler of Rename doesn't return anything but we are passing TestFile-${__time(,)}.docx in request parameter, any way to get that name?


Solution

  • If you change this:

    TestFile-${__time(,)}.docx
    

    to this:

    TestFile-${__time(,postfix)}.docx
    

    you will be able to access the value generated by the __time() function as ${postfix} JMeter Variable like:

    TestFile-${postfix}.docx
    

    More information: Apache JMeter Functions - An Introduction