Am Tue, Nov 22, 2022 at 03:59:27AM -0600 schrieb Dale:
> > If you still want to stick to a terminal solution akin to mv, then there is
> > no way around a little script which wraps mv by extracting the extension and
> > filename base. You could also add some “intelligence” with regards to
> > directories, in order to reduce the amount of effort required to use the
> > command—in case your directories follow some schema or are constant.
> >
> >
> > #!/usr/bin/sh
> >
> > [ "$#" -ne "2" ] && exit 1
> > SRC="$1"
> > DST="$2"
> >
> > SRC_EXT="${SRC##*.}"
> > DST_BASE="${DST%.*}"
> >
> > # remove destination for the case that the extensions differ
> > rm "$DST"
> >
> > mv "$SRC" "${DST_BASE}${SRC_EXT}"
> >
>
> I finally got a chance to try this. I saved it and made it executable.
> It runs but gave me this error.
>
>
> dmv torrent/video_name-old-place.mp4 video-name-new-place.mp4
> bash: /bin/dmv: /usr/bin/sh: bad interpreter: No such file or directory
> dale@fireball ~/Desktop/Crypt/Series $
>
>
> My scripting skills are minimal at best. Still, I kinda got what your
> script was doing. Those who have known me for a while understand how
> miraculous that is. ROFL I did some googling. It seems to not be able
> to find the 'shebang' part. Sure enough, sh isn't located in /usr/bin
> here. It's in /bin tho. I edited that line so it can find it. When I
> tried it, it worked but noticed another problem. […]Well, it would have been boring to provide you with a turn-key solution. ;-) Congrats on getting it working. In my Arch setup, sh is in /usr/bin. A flexible solution is to use #!/usr/bin/env sh, which looks the command up before executing it. > I added a little . on that last line before the extension bit. I'm a > happy camper. Give me a nudge if you want the more luxurious version with interactive selection of the overwrite destination. I think I already started a prototype somewhere, but can’t find it right now. -- Grüße | Greetings | Salut | Qapla’ Please do not share anything from, with or about me on any social network. The best thing about Sundays is Saturday evening.
signature.asc
Description: PGP signature

