Sorry, did not read your message to the end. So the sixth line on that script, on your case, instead of:
j=`echo $i | sed s/\ \-\ unwantedString//` should be: j="Person of Interest - "$i I guess that's it. You will have to open a console at the directory where your movies are in. Francisco On Thu, Dec 1, 2011 at 12:19 AM, Francisco Ares <fra...@gmail.com> wrote: > I use the following script to remove parts of downloaded videos, I guess > it wont't be hard to figure out how to change it to your needs. It also > creates a text file with the name of the file and, expecting it to be a > video file, it uses midentify, part of the mplayer package, to read the > duration of the video in a form that LibreOffice is able to import directly. > > > > #! /bin/bash > for i in *unwantedString.??? # it can be a MP4 or a FLV > do > if [ "$i" != "*unwantedString.???" ] # this checks if the list is > empty > then > j=`echo $i | sed s/\ \-\ unwantedString//` > # echo $j > mv "$i" "$j" > fi > done > > for i in *.mp4 *.flv # this removes duplicated file extension > do > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ] > then > j=`echo $i | sed -e s/\.mp4\.mp4/\.mp4/ -e s/\.flv\.flv/\.flv/` > # echo $j > if [ "$i" != "$j" ] > then > mv "$i" "$j" > fi > fi > done > > if [ -e contents.txt ] > then > rm contents.txt > fi > for i in *.mp4 *.flv > do > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ] > then > j=`midentify "$i" | grep ID_LENGTH | cut -d\= -f 2` > k=`echo $i | sed -e s/\.mp4//g -e s/\.flv//g` > echo -e $k \\t 00:00:`echo $j | cut -d\. -f1`,`echo $j | cut -d \. > -f2` >> contents.txt > fi > done > > Hope it helps > Francisco > > > > > On Wed, Nov 30, 2011 at 11:49 PM, Dale <rdalek1...@gmail.com> wrote: > >> Greets, >> >> I ran into a problem. I been downloading a lot of TV shows. I forgot to >> put a sort of important part in the names. This is what I have with the >> full path: >> >> /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4 >> >> This is what I need it to be: >> >> /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1, >> Episode 1 - Pilot.mp4 >> >> Basically, I need to add the name of the show to the name of the file. >> They will all be added to the front of the names. They also almost all >> contain spaces, which means some fancy footwork with the \. >> >> Is there a way to do this? I have room to copy them to another directory >> if needed. I would sort of actually prefer it that way since if it messes >> up, I got the originals at least. >> >> Sorry I'm not real good at gawk, sed and all those things. I suspect >> those will be used tho. I am familiar with | and grep tho. ;-) >> >> Thoughts? >> >> Dale >> >> :-) :-) >> >> -- >> I am only responsible for what I said ... Not for what you understood or >> how you interpreted my words! >> >> >> > > > -- > "If you have an apple and I have an apple and we exchange apples then you > and I will still each have one apple. But if you have an idea and I have > one idea and we exchange these ideas, then each of us will have two ideas." > - George Bernard Shaw > -- "If you have an apple and I have an apple and we exchange apples then you and I will still each have one apple. But if you have an idea and I have one idea and we exchange these ideas, then each of us will have two ideas." - George Bernard Shaw