Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.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:48:56
Message-Id: 4ED6EA99.3050009@gmail.com
In Reply to: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually. by Frank Steinmetzger
1 Frank Steinmetzger wrote:
2 > On Wed, Nov 30, 2011 at 07:49:26PM -0600, Dale wrote:
3 >
4 >> I ran into a problem. I been downloading a lot of TV shows. I forgot
5 >> to put a sort of important part in the names. This is what I have with
6 >> the full path:
7 >>
8 >> /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4
9 >>
10 >> This is what I need it to be:
11 >>
12 >> /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1,
13 >> Episode 1 - Pilot.mp4
14 >>
15 >> Basically, I need to add the name of the show to the name of the file.
16 >> They will all be added to the front of the names. They also almost all
17 >> contain spaces, which means some fancy footwork with the \.
18 >>
19 >> Is there a way to do this? I have room to copy them to another
20 >> directory if needed. I would sort of actually prefer it that way since
21 >> if it messes up, I got the originals at least.
22 >>
23 >> Sorry I'm not real good at gawk, sed and all those things. I suspect
24 >> those will be used tho. I am familiar with | and grep tho. ;-)
25 >>
26 >> Thoughts?
27 > I can’t remember right now what graphical environment you use, but for KDE
28 > there is KRename. But if you want it quick and efficient, I suggest
29 > renameutils. You give it a list of files and it opens $EDITOR containing two
30 > columns with the list. The first is the old name, and in the second you can
31 > enter the new name.
32 >
33 > It’s basically a mass renamer for the console, powered by your favorite
34 > features of your favorite editor. With the recursive flag -R you can even do
35 > what you want for many dirs at once and then insert the Series name using
36 > search and replace with regular expressions.
37 >
38 > But your particular example could be done simply with:
39 >
40 > cd "/data/Movies/TV_Series/Person of Interest"
41 > for i in *.mp4; do mv -n "$i" "Person of Interest - $i"; done
42
43 Oh heck yea. Krename did a wonderful job. It renamed them in place. I
44 tested it on a small directory with just a few files at first. This is
45 cool. I didn't know KDE had this and it wasn't installed either.
46
47 No grep, gawk or sed in the command line for this? Wow. I thought
48 there would be at least a couple of those in there. lol
49
50 Thanks for the info. I didn't even think there would be a GUI for
51 this. o_O
52
53 Dale
54
55 :-) :-)
56
57 --
58 I am only responsible for what I said ... Not for what you understood or how you interpreted my words!