Gentoo Archives: gentoo-user

From: Frank Steinmetzger <Warp_7@×××.de>
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:19:54
Message-Id: 20111201021821.GD23374@eisen.lan
In Reply to: [gentoo-user] Changing names of LOTS of files, adding to them actually. by Dale
1 On Wed, Nov 30, 2011 at 07:49:26PM -0600, Dale wrote:
2
3 > I ran into a problem. I been downloading a lot of TV shows. I forgot
4 > to put a sort of important part in the names. This is what I have with
5 > the full path:
6 >
7 > /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4
8 >
9 > This is what I need it to be:
10 >
11 > /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1,
12 > Episode 1 - Pilot.mp4
13 >
14 > Basically, I need to add the name of the show to the name of the file.
15 > They will all be added to the front of the names. They also almost all
16 > contain spaces, which means some fancy footwork with the \.
17 >
18 > Is there a way to do this? I have room to copy them to another
19 > directory if needed. I would sort of actually prefer it that way since
20 > if it messes up, I got the originals at least.
21 >
22 > Sorry I'm not real good at gawk, sed and all those things. I suspect
23 > those will be used tho. I am familiar with | and grep tho. ;-)
24 >
25 > Thoughts?
26
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 Gruß | Greetings | Qapla'
44 I forbid any use of my email addresses with Facebook services.
45
46 The advantage of smartness is that one can pretend to be stupid.
47 The opposite is far more difficult.

Replies

Subject Author
Re: [gentoo-user] Changing names of LOTS of files, adding to them actually. Dale <rdalek1967@×××××.com>