[mythtv-users] make a copy of .nuv as .mpg

Craig Box craig at dubculture.co.nz
Sat Oct 16 18:15:37 UTC 2004


On Sat, 2004-10-16 at 13:57 -0400, Doug Larrick wrote:
> Matt Hannan wrote:
> > cp /storage/TV/recording/*.nuv /storage/Videos/*.mpg
> > cp: `/storage/Videos/*.mpg': specified destination directory does not exist
> 
> The problem is that the shell does not do substitution of the first * 
> for the second.  You need to be a little more explicit:
> 
> If you are using Bash (or another sh variant):
> 
> for file in /storage/TV/recording/*.nuv; do
>    export base=`basename $file .nuv`
>    cp /storage/TV/recording/${base}.nuv /storage/Videos/${base}.mpg
>    unset base
> done

Bash does some pretty cool things:

cd /storage/TV/recording/
for i in *.nuv; do cp $i /storage/Videos/${i/nuv/mpg}; done

Check out http://www.wlug.org.nz/BashNotes (or wade through dozens and
dozens of pages of "man 1 bash").

Craig



More information about the mythtv-users mailing list