How to test multiple files in a folder


I´m testing audio files and I´m pretty new to robot.
Right now I have multiple .robot test suites which mostly compare one file, which is located in the “input” directory with another file, which is located in the “output” directory.
The names of the files are generic but they all have .wav in common.

My Question:
How can I loop over the files in the directory (f.e. “input”) and use those files in my program.
Hardcoding works but changing names of files shouldn´t be one of the tasks one must do to use the testing suite.
In stupid code: “go into directory, give me all files with .wav in a row for further processing.”

You could use List Directory keyword from OperatingSystem library and loop over result. Something like this:

${files}    List Directory    /path/to/input    *.wav
FOR    ${file}    IN    @{files}
    Log    ${file}

Tried it before but your code works (the first is an @ and not $ for future readers)
Though the log only says *.wav and doesnt give me, lets say, a listing of the files. Is that normal?

@{files} List Directory ${CURDIR}${/}test_input *.wav
FOR ${file} IN @{files}
Log ${file}

I had the
@{files} List Directory ect …
under variables. So I declared a list with List Directory, the path and *.wav. My bad, thanks! It works now :slight_smile: