Loop through folder? How to find conditions file only with string

Hi

Is it possible to loop through a number of files in a folder from psychopy and select only one including a specific string (expInfo[‘participant’]) in its name? Say you run a multi-part study and you want to access the participant’s datafile from a previous part.

Because the name of the datafile cannot be changed when running the study online, I cannot simply call the datafile expInfo[‘participant’].

Thank you!

The way I’m going to try to deal with this is via Qualtrics contacts – I’m planning to send the score from each training session to Qualtrics and update the contact. Then each PsychoPy session will be initiated by a Qualtrics intro where the variables are set.

Thanks for this suggestion. I am not familiar with integrating Qualtrics and PsychoPy, but this might be the best way to go! :slight_smile: Now, I make a copy of and rename the datafiles and find the conditions file the following way, though it’s not great if there are many participants, because they load all files when initiating the study

file = expInfo[‘participant’];
path = “files/” + file + “.csv”;

I suppose I could simply create a single csv file including relevant data from part 1 from all participants (as long as everyone completes part 1 before part 2 starts) and set Selected rows in the relevant loop equal the row which contains relevant participant. I only need the first row of data for each participant. I don’t know why I did not think of this before :face_with_monocle:.

edit: I can also try to manually download a single file per participant as you describe in your crib sheet (p. 13)