2021年3月11日星期四

How to loop through a folder and add the names of all the files into cells in a column in Libreoffice? Using .csv and Anki

I have several folders, each containing several thousand .mp3 files of example sentences spoken by native speakers. I want to loop through the folder in order and add all the names of the files to the first column of a LibreOffice spreadsheet, so in each cell in the column it looks like [sound:name_of_file.mp3]. The names of the file are in order, but they are split up by section and chapter, so it would be easier if there was a way to grab the name of the file and use that, as opposed to coming up with a function that changes the text based on a for loop or something like that.

I want to create a .csv file including all the [sound:name_of_file.mp3] text, that I will upload into Anki as a deck, and then just copy all the .mp3 files from each of the original folders into Anki's media folder so the card references the audio and plays it.

Is there a way to do this, and if so, how would it be done?

Thank you!

https://stackoverflow.com/questions/66593617/how-to-loop-through-a-folder-and-add-the-names-of-all-the-files-into-cells-in-a March 12, 2021 at 11:08AM

没有评论:

发表评论