Is there some command to search a directory for files and output the result to a file with a prefix text before name of file that was found?
For example, I have a directory with these files:
sound1
sound2
sound3
…
Then give a command to search the directory and write the results to a text file with a prefix before it, e.g.
media sound1
media sound2
media sound3
…
Bonus question
Is there a way to write "media1", "media 2" etc... instead of just "media" to an existing text file without deleting what was inside that text file before?
media1 sound1
media2 sound2
media3 sound3
…