Export M3U script to ignore sub folders

The easiest way would be to use the function File>Create Playlist (for selected files).
This will save the playlist in the current working directory.
Or see e.g. here: