Related scripts to the Master's Thesis "Exploring Sonification in Website Navigation on Smartphones"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
920 B

3 months ago
  1. import os
  2. main_directory = './'
  3. participant_dirs = range(1, 34)
  4. output_file = os.path.join(main_directory, 'merged_notes.txt')
  5. with open(output_file, 'w') as outfile:
  6. for participant in participant_dirs:
  7. participant_dir = os.path.join(main_directory, str(participant))
  8. if os.path.exists(participant_dir):
  9. for filename in os.listdir(participant_dir):
  10. if filename.endswith('.txt'):
  11. file_path = os.path.join(participant_dir, filename)
  12. outfile.write(f"\n\n--- Participant {participant} ---\n\n")
  13. with open(file_path, 'r') as infile:
  14. outfile.write(infile.read())
  15. else:
  16. print(f"Directory {participant_dir} does not exist.")
  17. print("Merging complete. Check the merged_notes.txt file in the main directory.")