Gentoo Archives: gentoo-user

From: Francisco Ares <frares@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
Date: Thu, 01 Dec 2011 02:28:48
Message-Id: CAHH9eM4O4zoyJ7mCCgtQ7xbqG8gmh9f7LaGp6gXNN2SsO1qKkA@mail.gmail.com
In Reply to: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually. by Francisco Ares
1 Sorry, did not read your message to the end.
2
3 So the sixth line on that script, on your case, instead of:
4
5 j=`echo $i | sed s/\ \-\ unwantedString//`
6
7 should be:
8
9 j="Person of Interest - "$i
10
11 I guess that's it. You will have to open a console at the directory where
12 your movies are in.
13
14 Francisco
15
16
17
18 On Thu, Dec 1, 2011 at 12:19 AM, Francisco Ares <frares@×××××.com> wrote:
19
20 > I use the following script to remove parts of downloaded videos, I guess
21 > it wont't be hard to figure out how to change it to your needs. It also
22 > creates a text file with the name of the file and, expecting it to be a
23 > video file, it uses midentify, part of the mplayer package, to read the
24 > duration of the video in a form that LibreOffice is able to import directly.
25 >
26 >
27 >
28 > #! /bin/bash
29 > for i in *unwantedString.??? # it can be a MP4 or a FLV
30 > do
31 > if [ "$i" != "*unwantedString.???" ] # this checks if the list is
32 > empty
33 > then
34 > j=`echo $i | sed s/\ \-\ unwantedString//`
35 > # echo $j
36 > mv "$i" "$j"
37 > fi
38 > done
39 >
40 > for i in *.mp4 *.flv # this removes duplicated file extension
41 > do
42 > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ]
43 > then
44 > j=`echo $i | sed -e s/\.mp4\.mp4/\.mp4/ -e s/\.flv\.flv/\.flv/`
45 > # echo $j
46 > if [ "$i" != "$j" ]
47 > then
48 > mv "$i" "$j"
49 > fi
50 > fi
51 > done
52 >
53 > if [ -e contents.txt ]
54 > then
55 > rm contents.txt
56 > fi
57 > for i in *.mp4 *.flv
58 > do
59 > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ]
60 > then
61 > j=`midentify "$i" | grep ID_LENGTH | cut -d\= -f 2`
62 > k=`echo $i | sed -e s/\.mp4//g -e s/\.flv//g`
63 > echo -e $k \\t 00:00:`echo $j | cut -d\. -f1`,`echo $j | cut -d \.
64 > -f2` >> contents.txt
65 > fi
66 > done
67 >
68 > Hope it helps
69 > Francisco
70 >
71 >
72 >
73 >
74 > On Wed, Nov 30, 2011 at 11:49 PM, Dale <rdalek1967@×××××.com> wrote:
75 >
76 >> Greets,
77 >>
78 >> I ran into a problem. I been downloading a lot of TV shows. I forgot to
79 >> put a sort of important part in the names. This is what I have with the
80 >> full path:
81 >>
82 >> /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4
83 >>
84 >> This is what I need it to be:
85 >>
86 >> /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1,
87 >> Episode 1 - Pilot.mp4
88 >>
89 >> Basically, I need to add the name of the show to the name of the file.
90 >> They will all be added to the front of the names. They also almost all
91 >> contain spaces, which means some fancy footwork with the \.
92 >>
93 >> Is there a way to do this? I have room to copy them to another directory
94 >> if needed. I would sort of actually prefer it that way since if it messes
95 >> up, I got the originals at least.
96 >>
97 >> Sorry I'm not real good at gawk, sed and all those things. I suspect
98 >> those will be used tho. I am familiar with | and grep tho. ;-)
99 >>
100 >> Thoughts?
101 >>
102 >> Dale
103 >>
104 >> :-) :-)
105 >>
106 >> --
107 >> I am only responsible for what I said ... Not for what you understood or
108 >> how you interpreted my words!
109 >>
110 >>
111 >>
112 >
113 >
114 > --
115 > "If you have an apple and I have an apple and we exchange apples then you
116 > and I will still each have one apple. But if you have an idea and I have
117 > one idea and we exchange these ideas, then each of us will have two ideas."
118 > - George Bernard Shaw
119 >
120
121
122
123 --
124 "If you have an apple and I have an apple and we exchange apples then you
125 and I will still each have one apple. But if you have an idea and I have
126 one idea and we exchange these ideas, then each of us will have two ideas."
127 - George Bernard Shaw