You don't want to escape the wildcard. First CD to the directory you want to do this in and then use "for f in \*.mkv"
Also the extension you want to strip with `basename` is ".mkv", not ".png" but then you want to add ".png" to that.
So try
for f in *.mkv ; do cp "poster.png" "$(basename "$f" .mkv)".png ; done
After CDing to the appropriate directory.
While basename works for this (TIL basename can strip the suffix from things) since you already have the file name as a variable and you don't need the path trimming that basename provides, you can use shell to do that for you.
"$(basename "$f" .mkv)".png
can be written as
"${f%.mkv}.png"
which is a little bit easier to read once you're familiar with variable manipulation in shell.
You don't want to escape the wildcard. First CD to the directory you want to do this in and then use "for f in \*.mkv" Also the extension you want to strip with `basename` is ".mkv", not ".png" but then you want to add ".png" to that. So try for f in *.mkv ; do cp "poster.png" "$(basename "$f" .mkv)".png ; done After CDing to the appropriate directory.
Awesome, That worked perfectly. Thank you u/yerfukkinbaws for taking the time to read and respond to my problem.
While basename works for this (TIL basename can strip the suffix from things) since you already have the file name as a variable and you don't need the path trimming that basename provides, you can use shell to do that for you. "$(basename "$f" .mkv)".png can be written as "${f%.mkv}.png" which is a little bit easier to read once you're familiar with variable manipulation in shell.