I'm new to the Mac Terminal. I am attempting to provide ffmpeg a .txt file containing a list of .mp4 files from a directory to concat into a new file. For this post, I only want to focus on creating the list in the way that ffmpeg requires.
My directory has four files:
file1.mp4
file2.mp4
file3.mp4
otherclip.mov
I need to have the command line look at this directory, ignore the .mov file and create a txt file in the following way.
file 'file1.mp4'
file 'file2.mp4'
file 'file3.mp4'
Assuming I'm already in the correct directory how do I loop through the files and place the .mp4 files in a txt file with the text file 'filename.mp4' wrapped around it?
I saw someone on Windows successfully do this by running
for /f "tokens=*" %i in ('dir *.mp4 /b') do echo file '%~ni%~xi' >> list.txt
I'm not sure what the bash equivalent would be but when I ran that in my terminal it returned -bash: syntax error near unexpected token `"tokens=*"'
file1.mp4
etc.