Alternatively you can generate this string after you're done finding the files.

```python
'\n'.join(files_to_upload)
```

I doubt people will be uploading millions and millions of files so I'd take simplicity over potential speed in this case.