* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
@ 2011-12-01 2:18 ` Frank Steinmetzger
2011-12-01 2:46 ` Dale
2011-12-01 2:19 ` Francisco Ares
` (5 subsequent siblings)
6 siblings, 1 reply; 21+ messages in thread
From: Frank Steinmetzger @ 2011-12-01 2:18 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]
On Wed, Nov 30, 2011 at 07:49:26PM -0600, Dale wrote:
> 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?
I can’t remember right now what graphical environment you use, but for KDE
there is KRename. But if you want it quick and efficient, I suggest
renameutils. You give it a list of files and it opens $EDITOR containing two
columns with the list. The first is the old name, and in the second you can
enter the new name.
It’s basically a mass renamer for the console, powered by your favorite
features of your favorite editor. With the recursive flag -R you can even do
what you want for many dirs at once and then insert the Series name using
search and replace with regular expressions.
But your particular example could be done simply with:
cd "/data/Movies/TV_Series/Person of Interest"
for i in *.mp4; do mv -n "$i" "Person of Interest - $i"; done
--
Gruß | Greetings | Qapla'
I forbid any use of my email addresses with Facebook services.
The advantage of smartness is that one can pretend to be stupid.
The opposite is far more difficult.
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 2:18 ` Frank Steinmetzger
@ 2011-12-01 2:46 ` Dale
0 siblings, 0 replies; 21+ messages in thread
From: Dale @ 2011-12-01 2:46 UTC (permalink / raw
To: gentoo-user
Frank Steinmetzger wrote:
> On Wed, Nov 30, 2011 at 07:49:26PM -0600, Dale wrote:
>
>> 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?
> I can’t remember right now what graphical environment you use, but for KDE
> there is KRename. But if you want it quick and efficient, I suggest
> renameutils. You give it a list of files and it opens $EDITOR containing two
> columns with the list. The first is the old name, and in the second you can
> enter the new name.
>
> It’s basically a mass renamer for the console, powered by your favorite
> features of your favorite editor. With the recursive flag -R you can even do
> what you want for many dirs at once and then insert the Series name using
> search and replace with regular expressions.
>
> But your particular example could be done simply with:
>
> cd "/data/Movies/TV_Series/Person of Interest"
> for i in *.mp4; do mv -n "$i" "Person of Interest - $i"; done
Oh heck yea. Krename did a wonderful job. It renamed them in place. I
tested it on a small directory with just a few files at first. This is
cool. I didn't know KDE had this and it wasn't installed either.
No grep, gawk or sed in the command line for this? Wow. I thought
there would be at least a couple of those in there. lol
Thanks for the info. I didn't even think there would be a GUI for
this. o_O
Dale
:-) :-)
--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
2011-12-01 2:18 ` Frank Steinmetzger
@ 2011-12-01 2:19 ` Francisco Ares
2011-12-01 2:23 ` Francisco Ares
2011-12-01 2:22 ` Pandu Poluan
` (4 subsequent siblings)
6 siblings, 1 reply; 21+ messages in thread
From: Francisco Ares @ 2011-12-01 2:19 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 2701 bytes --]
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 <rdalek1967@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
[-- Attachment #2: Type: text/html, Size: 3908 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 2:19 ` Francisco Ares
@ 2011-12-01 2:23 ` Francisco Ares
0 siblings, 0 replies; 21+ messages in thread
From: Francisco Ares @ 2011-12-01 2:23 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 3490 bytes --]
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 <frares@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 <rdalek1967@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
[-- Attachment #2: Type: text/html, Size: 5144 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
2011-12-01 2:18 ` Frank Steinmetzger
2011-12-01 2:19 ` Francisco Ares
@ 2011-12-01 2:22 ` Pandu Poluan
2011-12-01 2:29 ` Pandu Poluan
2011-12-01 2:22 ` bill.longman
` (3 subsequent siblings)
6 siblings, 1 reply; 21+ messages in thread
From: Pandu Poluan @ 2011-12-01 2:22 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
On Dec 1, 2011 8:54 AM, "Dale" <rdalek1967@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?
>
'find' and 'mv' should do the job. With some help from 'dirname' and
'basename'. E. g.
find $PATHTOMOVIES -name "*. mp4" -exec mv "{}" "\$(dirname {})/$(basename
$(dirname {})) - $(basename {})"
Not tested, though. So you'd better use 'echo' instead of 'mv' for a dry
run.
Rgds,
[-- Attachment #2: Type: text/html, Size: 1640 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 2:22 ` Pandu Poluan
@ 2011-12-01 2:29 ` Pandu Poluan
0 siblings, 0 replies; 21+ messages in thread
From: Pandu Poluan @ 2011-12-01 2:29 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]
On Dec 1, 2011 9:22 AM, "Pandu Poluan" <pandu@poluan.info> wrote:
>
>
> On Dec 1, 2011 8:54 AM, "Dale" <rdalek1967@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?
> >
>
> 'find' and 'mv' should do the job. With some help from 'dirname' and
'basename'. E. g.
>
> find $PATHTOMOVIES -name "*. mp4" -exec mv "{}" "\$(dirname
{})/$(basename $(dirname {})) - $(basename {})"
>
> Not tested, though. So you'd better use 'echo' instead of 'mv' for a dry
run.
>
Whoopsies. I certainly must've made some mistakes with the escaping
there...
Oh well, just write a short script containing this:
mv "$1" "$(dirname $1)/$(basename $(dirname $1)) - $(basename $1)"
and feed that script (after chmod +x, of course) to the -exec part of
find, e.g.
find ... -exec scriptname.sh {} \;
Rgds,
[-- Attachment #2: Type: text/html, Size: 2306 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
` (2 preceding siblings ...)
2011-12-01 2:22 ` Pandu Poluan
@ 2011-12-01 2:22 ` bill.longman
2011-12-01 3:23 ` Frank Steinmetzger
2011-12-01 4:18 ` Dale
` (2 subsequent siblings)
6 siblings, 1 reply; 21+ messages in thread
From: bill.longman @ 2011-12-01 2:22 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/html, Size: 1797 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
` (3 preceding siblings ...)
2011-12-01 2:22 ` bill.longman
@ 2011-12-01 4:18 ` Dale
2011-12-01 8:53 ` Neil Bothwick
2011-12-01 9:34 ` Stroller
6 siblings, 0 replies; 21+ messages in thread
From: Dale @ 2011-12-01 4:18 UTC (permalink / raw
To: gentoo-user
Dale 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 got them all changed, about 250 or so of them. Thanks to *all* for
the replies. I got to save and review some of the command line ones
too. May learn something. Sort of reminds me of my old Vic-20. O_O
Thanks much.
Dale
:-) :-)
--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
` (4 preceding siblings ...)
2011-12-01 4:18 ` Dale
@ 2011-12-01 8:53 ` Neil Bothwick
2011-12-01 9:34 ` Stroller
6 siblings, 0 replies; 21+ messages in thread
From: Neil Bothwick @ 2011-12-01 8:53 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Wed, 30 Nov 2011 19:49:26 -0600, Dale wrote:
> 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
emerge renamexm
renamexm -s/Season/Person\ of\ Interest\ -\ Season/ /data/Movies/TV_Series/Person of Interest/Season*
Run it with -t first to make sure it will do what you want.
--
Neil Bothwick
Energizer Bunny arrested, charged with battery :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
` (5 preceding siblings ...)
2011-12-01 8:53 ` Neil Bothwick
@ 2011-12-01 9:34 ` Stroller
2011-12-01 10:42 ` Dale
2011-12-01 10:55 ` Helmut Jarausch
6 siblings, 2 replies; 21+ messages in thread
From: Stroller @ 2011-12-01 9:34 UTC (permalink / raw
To: gentoo-user
On 1 December 2011, at 01:49, Dale wrote:
> ...
> 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 \.
I see you've renamed your files already, but as a reference answer:
`rename` from sys-apps/util-linux is ok.
sys-apps/renameutils should be installed on every system, IMO, and aliased thus in your .bashrc:
alias qmv="qmv -f do"
alias qcp="qcp -f do"
Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
Stroller.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 9:34 ` Stroller
@ 2011-12-01 10:42 ` Dale
2011-12-01 15:29 ` Frank Steinmetzger
2011-12-02 10:50 ` Stroller
2011-12-01 10:55 ` Helmut Jarausch
1 sibling, 2 replies; 21+ messages in thread
From: Dale @ 2011-12-01 10:42 UTC (permalink / raw
To: gentoo-user
Stroller wrote:
> On 1 December 2011, at 01:49, Dale wrote:
>> ...
>> 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 \.
> I see you've renamed your files already, but as a reference answer:
>
> `rename` from sys-apps/util-linux is ok.
>
> sys-apps/renameutils should be installed on every system, IMO, and aliased thus in your .bashrc:
>
> alias qmv="qmv -f do"
> alias qcp="qcp -f do"
>
> Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
>
> Stroller.
>
>
>
vi? O_O Would nano not work? I got stuck in vi once. I felt like I
was in Hotel California. :/ Got that tune in your head now huh? lol
I'm going to see what else is available too. I bet since Krename is
installed, rename is installed too. I'm sure Krename is just a GUI
front end to something already on here.
Oh, if I learn vi, I'd learn sed, gawk and those other weird named
commands too. I'd be a official something. I'm already called a geek
and a nerd. ;-) Gentoo you know?
Dale
:-) :-)
--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 10:42 ` Dale
@ 2011-12-01 15:29 ` Frank Steinmetzger
2011-12-02 17:33 ` James Broadhead
2011-12-02 10:50 ` Stroller
1 sibling, 1 reply; 21+ messages in thread
From: Frank Steinmetzger @ 2011-12-01 15:29 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
On Thu, Dec 01, 2011 at 04:42:04AM -0600, Dale wrote:
> >> 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 \.
> > I see you've renamed your files already, but as a reference answer:
> >
> > `rename` from sys-apps/util-linux is ok.
> >
> > Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
> vi? O_O Would nano not work? I got stuck in vi once. I felt like I
> was in Hotel California. :/ Got that tune in your head now huh? lol
I used to get stuck in vi, but at some point I asked a friend to give me a
proper introduction and now I can’t live without it anymore. Things like block
select (very useful for renaming files in qmv), redo last action and registers
are a bummer.
--
Gruß | Greetings | Qapla'
I forbid any use of my email addresses with Facebook services.
„Afrika hat an allen vier Ecken eine rundliche Gestalt,
die sich gegen die Mitte verengt.“ – Galletti
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 10:42 ` Dale
2011-12-01 15:29 ` Frank Steinmetzger
@ 2011-12-02 10:50 ` Stroller
2011-12-02 15:43 ` Frank Steinmetzger
1 sibling, 1 reply; 21+ messages in thread
From: Stroller @ 2011-12-02 10:50 UTC (permalink / raw
To: gentoo-user
On 1 December 2011, at 10:42, Dale wrote:
>> ...
>> sys-apps/renameutils should be installed on every system, IMO, and aliased thus in your .bashrc:
>>
>> alias qmv="qmv -f do"
>> alias qcp="qcp -f do"
>>
>> Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
>
> vi? O_O Would nano not work? I got stuck in vi once. I felt like I was in Hotel California. :/ Got that tune in your head now huh? lol
>
> I'm going to see what else is available too. I bet since Krename is installed, rename is installed too. I'm sure Krename is just a GUI front end to something already on here.
nano would work.
When you use renameutils in --format=destination-only (`-f do`) mode, you just get a list of current file names in your text editor. You change them to the new names you desire and when you save the text file (and exit) the rename is completed. If you make such an error that you don't want the changes to apply you exit the text editor without saving.
The reason that vi or vim is recommendation-worthy is that you can do advanced search and replace and save macro functions for (for example) fixing capitalisation [1] or changing underscores or periods to spaces.
It would be easy, for example, to save a function in your .vimrc to change every instance of SxxEyy (e.g. S01E13) to "Season xx - Episode yy".
Sure, you can do all this with the other tools suggested by others, but each time you're going to have to use the mouse to select the "from" box in the GUI, then type "_", then mouse to the "to" box and type " " and so on. You're going to be performing the same handful of identical functions each time. In vim you can save these and activate them with the f2, f3, f4 keys.
An advantage of using the search and replace within a text editor is that you'll be able to see these kinds of automatable filename changes *alongside* edits that you'll want to make manually, and you can see the results immediately. So if you misdo the search and replace you can just use vim's undo command, and then redo the replace with the same starting point you used before. This is clearly much better than realising that "whups! i've renamed all these files wrongly now" and having to work out the correct regrex based on their new filenames.
Finally, when you're dealing with whole series of TV shows, the ability to select by column, or to insert the same text at the same place on several different lines should not be underestimated.
Stroller.
[1] http://vim.wikia.com/wiki/Switching_case_of_characters#Twiddle_case
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-02 10:50 ` Stroller
@ 2011-12-02 15:43 ` Frank Steinmetzger
0 siblings, 0 replies; 21+ messages in thread
From: Frank Steinmetzger @ 2011-12-02 15:43 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
On Fri, Dec 02, 2011 at 10:50:37AM +0000, Stroller wrote:
>
> On 1 December 2011, at 10:42, Dale wrote:
> >> ...
> >> sys-apps/renameutils should be installed on every system, IMO, and aliased thus in your .bashrc:
> >>
> >> alias qmv="qmv -f do"
> >> alias qcp="qcp -f do"
> >>
> >> Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
> >
> > vi? O_O Would nano not work? I got stuck in vi once. I felt like I was in Hotel California. :/ Got that tune in your head now huh? lol
> >
> > I'm going to see what else is available too. I bet since Krename is installed, rename is installed too. I'm sure Krename is just a GUI front end to something already on here.
>
> nano would work.
>
> When you use renameutils in --format=destination-only (`-f do`) mode, you just get a list of current file names in your text editor. You change them to the new names you desire and when you save the text file (and exit) the rename is completed. If you make such an error that you don't want the changes to apply you exit the text editor without saving.
Ha, I didn’t know that, thanks. If it became necessary to do a search and
replace, I block-selected the first column and cut it into a register, anothe
buffer, or just deleted it away and at the end of editing, refetched the list
of files using :r !ls.
PS.: This mail was written in vi because I left KMail out of frustration for
the time being. ;-)
--
:x
:q
I forbid any use of my email addresses with Facebook services.
Das kann ja Eiter werden.
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 9:34 ` Stroller
2011-12-01 10:42 ` Dale
@ 2011-12-01 10:55 ` Helmut Jarausch
2011-12-01 13:22 ` James Broadhead
2011-12-02 10:21 ` Stroller
1 sibling, 2 replies; 21+ messages in thread
From: Helmut Jarausch @ 2011-12-01 10:55 UTC (permalink / raw
To: gentoo-user
On 12/01/2011 10:34:33 AM, Stroller wrote:
>
> On 1 December 2011, at 01:49, Dale wrote:
> > ...
> > 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
> \.
>
> I see you've renamed your files already, but as a reference answer:
>
> `rename` from sys-apps/util-linux is ok.
>
> sys-apps/renameutils should be installed on every system, IMO, and
> aliased thus in your .bashrc:
>
> alias qmv="qmv -f do"
> alias qcp="qcp -f do"
>
> Set $EDITOR to vi, and renaming TV shows becomes quick and easy.
>
I prefer sys-apps/pyrenamer which is (IMHO) even more comfortable.
Helmut.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 10:55 ` Helmut Jarausch
@ 2011-12-01 13:22 ` James Broadhead
2011-12-01 13:51 ` Paul Hartman
2011-12-02 10:21 ` Stroller
1 sibling, 1 reply; 21+ messages in thread
From: James Broadhead @ 2011-12-01 13:22 UTC (permalink / raw
To: gentoo-user
On 1 December 2011 10:55, Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:
> On 12/01/2011 10:34:33 AM, Stroller wrote:
>>
>> On 1 December 2011, at 01:49, Dale wrote:
>> > ...
>> > 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
>> >
I'm surprised that no one mentioned 'mmv', which I switched to from rename.
It has nice simple syntax, which is good for the _one thing that it
does_, which makes it nice and unixy.
All I've ever needed (I use python for anything more complex)
? Single character match
* String match until next token
#1, #2 , #3 for first match, second match etc.
cd /data/Movies/TV_Series/
# for all series
mmv "*/*" "#1/#1-#2"
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 13:22 ` James Broadhead
@ 2011-12-01 13:51 ` Paul Hartman
0 siblings, 0 replies; 21+ messages in thread
From: Paul Hartman @ 2011-12-01 13:51 UTC (permalink / raw
To: gentoo-user
On Thu, Dec 1, 2011 at 7:22 AM, James Broadhead
<jamesbroadhead@gmail.com> wrote:
> On 1 December 2011 10:55, Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:
>> On 12/01/2011 10:34:33 AM, Stroller wrote:
>>>
>>> On 1 December 2011, at 01:49, Dale wrote:
>>> > ...
>>> > 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
>>> >
>
> I'm surprised that no one mentioned 'mmv', which I switched to from rename.
> It has nice simple syntax, which is good for the _one thing that it
> does_, which makes it nice and unixy.
> All I've ever needed (I use python for anything more complex)
> ? Single character match
> * String match until next token
> #1, #2 , #3 for first match, second match etc.
>
> cd /data/Movies/TV_Series/
> # for all series
> mmv "*/*" "#1/#1-#2"
>
Seconded. I use mmv all the time! And I used to use "ren", its predecessor. :)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
2011-12-01 10:55 ` Helmut Jarausch
2011-12-01 13:22 ` James Broadhead
@ 2011-12-02 10:21 ` Stroller
1 sibling, 0 replies; 21+ messages in thread
From: Stroller @ 2011-12-02 10:21 UTC (permalink / raw
To: gentoo-user
On 1 December 2011, at 10:55, Helmut Jarausch wrote:
>
> I prefer sys-apps/pyrenamer which is (IMHO) even more comfortable.
That appears to require a GUI, X11 or whatever.
Stroller.
^ permalink raw reply [flat|nested] 21+ messages in thread