dudes named ben i need help with bash scripting pretty please! 95% there but cant make it work
Conversation
Notices
-
Embed this notice
This is the Breath :verified: (thisisthebreath@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:16:41 JST This is the Breath :verified: -
Embed this notice
This is the Breath :verified: (thisisthebreath@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:16:39 JST This is the Breath :verified: @DaemonFools find -type f -name \*.flac -exec bash -c 'i="{}"; o="/full/path/to/folder/tagged/${i}"; [[ -d "${o%/*}" ]] || mkdir -p "${o%/*}"; ffmpeg -i "$i" -i /need/full/path/to/foldersm.jpg -map a -map 1:v -disposition:v attached_pic -metadata:s:v comment="Cover (Front)" -codec copy "${o}"' \;
-
Embed this notice
Sir² Morgan (mh@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:16:39 JST Sir² Morgan @thisisthebreath @DaemonFools that's not a script. that's an abomination of an exec arg to find.
Theres many better and more legible ways to do it, but with that obligatory comment out of the way, I'm quite sure there's an argument to find that gives you the full path instead of relative
-
Embed this notice
This is the Breath :verified: (thisisthebreath@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:16:40 JST This is the Breath :verified: @DaemonFools im trying to call a file relative to other files. the script is recursively processing a list of directories, each one has a set of flac files and a foldersm.jpg that is unique to each folder. i cant figure out how to create a relative path to foldersm.jpg so i can run all the folders, i have to run them one at a time with a /absolute/path/to/foldersm.jpg
-
Embed this notice
RubberDucky (daemonfools@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:16:41 JST RubberDucky There's no query or script or code in the OP.
-
Embed this notice
Sir² Morgan (mh@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:27:44 JST Sir² Morgan @thisisthebreath @DaemonFools I can't seem to find it, so perhaps its an extension in some versions of find. in that case you can just incorporate a call to "realpath" into that, or use "xargs", or just make it a proper executable shell script
-
Embed this notice
Sir² Morgan (mh@noagendasocial.com)'s status on Friday, 11-Aug-2023 10:38:58 JST Sir² Morgan @thisisthebreath @DaemonFools
something like, off the top of my head on my phone:#!/bin/sh
for f in `find $1 -name '*.flac'`; do
mkdir -p somedir # does nothing if dir exists
IN=`realpath $f`
OUT=`$IN.output`
flac blahblah
doneyou can customize from there for what you want, more args to the script, etc
-
Embed this notice
This is the Breath :verified: (thisisthebreath@noagendasocial.com)'s status on Friday, 11-Aug-2023 19:25:13 JST This is the Breath :verified: @mh @DaemonFools is mkdir the output directory?
-
Embed this notice
Sir² Morgan (mh@noagendasocial.com)'s status on Friday, 11-Aug-2023 20:55:52 JST Sir² Morgan @thisisthebreath @DaemonFools yeah, you had something like that in your original version. you may want to use something like OUTF="`dirname $IN`/encoded"
mkdir -p $OUTF
OUT="${OUTF}/$f.flac"or something along those lines
-
Embed this notice