Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:12:30+00:00 2026-06-13T06:12:30+00:00

EDIT: the fixnames.sh called at the end is probably generating the error (particularly line

  • 0

EDIT: the fixnames.sh called at the end is probably generating the error (particularly line 2):

    #/bin/bash
    for x in *\'*;
    do
    y=$(echo "$x"| sed y/\'\,/__/)
    mv "$x" "$y"
    done

The problem line is the mv command at the end

    mv $OUTDIR/$OLD $OUTDIR/$NEW

It errors with something like:

    mv '*\* [something about unable to stat this]

This script was something I customized from one that had been posted here http://www.mythtv.org/wiki/Removing_Commercials and some other places. The goal of the mv was, iirc, to clean up the tmp directory (removing a symbolic link that I clunkily used to do a rename of the file). I’m a little unclear on what is happening in that mv line and the 2 lines prior that is apparently causing the script not to finish cleanly. Thanks for any input.

    #!/bin/sh
    VIDEODIR=$1
    FILENAME=$2
    CHANID=$3
    STARTTIME=$4
    # MythTV Install Prefix
    INSTALLPREFIX="/usr/bin"
    USRLOCALPREFIX="/usr/local/bin"
    HOMEDIR="/home/xxx"
    OUTDIR="/home/xxx/trans-out"
    TMPDIR="/home/xxx/trans-out/tmp"

    if [ ! -d $TMPDIR ]; then mkdir $TMPDIR; fi
    rm -f $TMPDIR/*

    # Sanity checking, to make sure everything is in order.
    if [ -z "$VIDEODIR" -o -z "$FILENAME" -o -z "$CHANID" -o -z "$STARTTIME" ]; then
            echo "Usage: $0 <VideoDirectory> <FileName> <CHANID> <STARTTIME>"
            exit 5
    fi
    if [ ! -f "$VIDEODIR/$FILENAME" ]; then
            echo "File does not exist: $VIDEODIR/$FILENAME"
            exit 6
    fi
    # The meat of the script. Flag commercials, copy the flagged commercials to
    # the cutlist, and transcode the video to remove the commercials from the
    # file.

    $INSTALLPREFIX/mythtranscode --chanid $CHANID --starttime $STARTTIME --mpeg2 --honorcutlist --showprogress -o $OUTDIR/$FILENAME.tmp
    ERROR=$?
    if [ $ERROR -ne 0 ]; then
            echo "Transcoding failed for ${FILENAME} with error $ERROR"
            exit $ERROR
    fi

    # use mythlink script to extract program information from database and make link in tmp subfolder for renaming of transcoded version.
    $USRLOCALPREFIX/mythlink.pl --link $TMPDIR --chanid $CHANID --starttime $STARTTIME --underscores --separator _ --format %T_%oY%om%od_%S

    # remove the map file since we are transcoding
    rm -f $OUTDIR/$FILENAME.tmp.map

    # set variables for newfilename-link and oldfilename-transcoded file and then to rename transcoded with link name
    NEW=$(ls $TMPDIR)
    OLD=$(ls $OUTDIR | grep -i "mpg.tmp" | awk '{ print $1; }')
    mv $OUTDIR/$OLD $OUTDIR/$NEW

    # remove commas and apostraphies
    cd $OUTDIR && $USRLOCALPREFIX/fixnames.sh
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:12:31+00:00Added an answer on June 13, 2026 at 6:12 am

    What this

    NEW=$(ls $TMPDIR)
    OLD=$(ls $OUTDIR | grep -i "mpg.tmp" | awk '{ print $1; }')
    mv $OUTDIR/$OLD $OUTDIR/$NEW
    

    is telling me is that your “.mpg.tmp” files resides in /home/xxx/trans-out, and you’re trying to move them (probably renamed to “.mpg” too?) to /home/xxx/trans-out/tmp (overwriting “.mpg” files with the same name?).

    As to why it’s not working, assume that NEW and OLD does indeed contain the list of files as you intended:

    • NEW contains “new1”, “new2”, “new3”
    • OLD contains “old1”, “old2”, “old3”

    The statement mv $OUTDIR/$OLD $OUTDIR/$NEW would then expand to

    mv $OUTDIR/new1 new2 new3 old1 $OUTDIR/old2 old3
    

    which would mean: move the 5 files (“$OUTDIR/new1”, “new2”, “new3”, “old1”, “$OUTDIR/old2”) to the directory “old3”.


    What I suspect would work is replacing that 3 lines with this

    for tmpfile in "$OUTDIR"/*.mpg.tmp; do
        mv "$tmpfile" "$TMPDIR/${tmpfile%.tmp}"
    done
    

    (I assumed that the awk was for removing ‘.tmp’ from the extension)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT : It turned out that this can only be done through an external
Edit: Solved, the error dissapeared whe I updated the package. I'm getting an error
EDIT: Problem solved... and unrelated to the phrasing of the question... sorry for the
Edit: The question in one line: How to pass along context from a MenuItem
Edit: This question looks like it might be the same problem, but has no
EDIT I had a problem a while ago writing a program in C which
(edit: On subsequent edit, the poster declared that the problem had been solved and
EDIT: I simplified the example to use text inputs. Same error. Form fails to
Edit : Array should be CvMat or IplImage is not an error message specific
*EDIT I have a list in my HTML called #wordlist. In this list I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.