Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm working on a shell script. To the backgroud: I recorded a lot of songs from the radio with my Mac. Each song is a *.eyetv "file" on my mac. Actually these "files" are just folders, containing a .mpg file with a cryptical filename like 00000000144ad5e9.mpg and some metadata.

The recordings are organized in a few folders, each containing like 20 recordings (an audio CD). All these folders are on a NAS.

I'm trying to write a script, which creates folders on my mac and then copies the mpgs into them renaming them to the name of their parent directory.

Directory structure on the NAS for the example song "Set fire to the Rain": /music/recordings1/Set Fire to the Rain - ADELE.eyetv/00000000144ad5e9.mpg (and some metadata for EyeTv)

Desired structure on my hard disc after copying: /home/me/music/recordings1/Set fire to the Rain.mpg

My (not working) code so far:

dirname=$(basename `pwd | tr ' ' '_'`.eyetv)
mkdir ~/Musik/$dirname
find . -name '*.eytv' | xargs -0 -i cd {} | find . -name ????????????????.mpg -print0 | xargs -0 -i cp -v {} ~/Musik/$dirname/$(basename `pwd | tr ' ' '_'`.mpg)

Greetings ant thanks in advance, Markus

share|improve this question
    
Welcome to askubuntu! NOT! Mac! see: en.wikipedia.org/wiki/Ubuntu_%28operating_system%29 –  blade19899 Nov 11 '13 at 19:28
    
Don't worry, I'm in the right place ;) I want to do this with my Ubuntu computer. Maybe I should have added that... Most players on Ubuntu play the mpgs directley. On my Mac I would have to convert them, which reduces the quality significantly. –  Markus Nov 11 '13 at 19:37

1 Answer 1

up vote 0 down vote accepted

You can use mcp:

mcp -v '/music/recordings1/* - *.eyetv/*.mpg' '/home/me/music/recordings1/#1.mpg'

mcp is included in mmv package. By default, mmv is not installed in Ubuntu, but you can install it from terminal using the following command:

sudo apt-get install mmv

See man mmv for more info.

share|improve this answer
    
Thanks a lot! This is exactly what I needed. I have some whitespace issues left, but I think, I can make it from here. –  Markus Nov 11 '13 at 20:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.