From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RVwN2-0007I1-Vy for garchives@archives.gentoo.org; Thu, 01 Dec 2011 02:27:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DC4F421C157; Thu, 1 Dec 2011 02:26:38 +0000 (UTC) Received: from svr-us4.tirtonadi.com (svr-us4.tirtonadi.com [69.65.43.212]) by pigeon.gentoo.org (Postfix) with ESMTP id E295121C13C for ; Thu, 1 Dec 2011 02:22:21 +0000 (UTC) Received: from mail-bw0-f53.google.com ([209.85.214.53]) by svr-us4.tirtonadi.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.69) (envelope-from ) id 1RVwI1-001NTH-Pu for gentoo-user@lists.gentoo.org; Thu, 01 Dec 2011 09:22:21 +0700 Received: by bkbzu5 with SMTP id zu5so155656bkb.40 for ; Wed, 30 Nov 2011 18:22:17 -0800 (PST) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.205.122.1 with SMTP id ge1mr4926074bkc.103.1322706137905; Wed, 30 Nov 2011 18:22:17 -0800 (PST) Received: by 10.223.96.72 with HTTP; Wed, 30 Nov 2011 18:22:17 -0800 (PST) Received: by 10.223.96.72 with HTTP; Wed, 30 Nov 2011 18:22:17 -0800 (PST) In-Reply-To: <4ED6DD26.1070604@gmail.com> References: <4ED6DD26.1070604@gmail.com> Date: Thu, 1 Dec 2011 09:22:17 +0700 Message-ID: Subject: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually. From: Pandu Poluan To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=000e0ce0f3207dfb0104b2fe855f X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - svr-us4.tirtonadi.com X-AntiAbuse: Original Domain - lists.gentoo.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - poluan.info X-Archives-Salt: 91265e59-7fa8-4870-94cb-8a8fd7639d2a X-Archives-Hash: 24b71e2842169b0d52ec79fc4934ba11 --000e0ce0f3207dfb0104b2fe855f Content-Type: text/plain; charset=UTF-8 On Dec 1, 2011 8:54 AM, "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? > '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, --000e0ce0f3207dfb0104b2fe855f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Dec 1, 2011 8:54 AM, "Dale" <rdalek1967@gmail.com> wrote:
>
> Greets,
>
> I ran into a problem. =C2=A0I been downloading a lot of TV shows. =C2= =A0I forgot to put a sort of important part in the names. =C2=A0This is wha= t 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.= =C2=A0They will all be added to the front of the names. =C2=A0They also al= most all contain spaces, which means some fancy footwork with the \.
>
> Is there a way to do this? =C2=A0I have room to copy them to another d= irectory if needed. =C2=A0I 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. =C2=A0I= suspect those will be used tho. =C2=A0I am familiar with | and grep tho. = =C2=A0;-)
>
> Thoughts?
>

'find' and 'mv' should do the job.=C2=A0 With some help = from 'dirname' and 'basename'.=C2=A0 E. g.

find $PATHTOMOVIES -name "*. mp4" -exec mv "{}" &quo= t;\$(dirname {})/$(basename $(dirname {})) - $(basename {})"

Not tested, though. So you'd better use 'echo' instead of &#= 39;mv' for a dry run.

Rgds,

--000e0ce0f3207dfb0104b2fe855f--