Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2013 21:35:22 -0800
From:      Devin Teske <devin.teske@fisglobal.com>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        User Questions <freebsd-questions@freebsd.org>
Subject:   Re: Renaming files
Message-ID:  <8F132714-16C2-4E8C-8451-0E316D0E2D87@fisglobal.com>
In-Reply-To: <CAAdA2WP4HcQEjnjR%2BeUq9EyfA9C5-Mgq6seByO8E4D95QY0p6g@mail.gmail.com>
References:  <CAAdA2WP4HcQEjnjR%2BeUq9EyfA9C5-Mgq6seByO8E4D95QY0p6g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 9, 2013, at 9:29 PM, Odhiambo Washington wrote:

> I have several files in this format:
>=20
> rw-r--r--   1 johndoe johndoe    20085 Jan  9 19:30 1357744249.26989.mbox=
:2,
> -rw-r--r--   1 johndoe johndoe    24419 Jan  9 19:30
> 1357744250.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe      418 Jan  9 19:30
> 1357744251.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe      418 Jan  9 19:30
> 1357744252.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe    78426 Jan  9 19:30
> 1357744254.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe     2561 Jan  9 19:30
> 1357744255.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe     6971 Jan  9 19:30
> 1357744257.26989.mbox:2,
> -rw-r--r--   1 johndoe johndoe    11270 Jan  9 19:30
> 1357744259.26989.mbox:2,
>=20
> I'd like to rename them so that the filenames are in the format below:
>=20
> -rw-------   1 johndoe johndoe  197702 Jan 10 03:00
> 1357776052.V803I33939aM83469.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe   14579 Jan 10 03:31
> 1357777873.V803I33939bM614733.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe   29212 Jan 10 03:46
> 1357778798.V803I33939cM995892.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe    2834 Jan 10 04:30
> 1357781421.V803I33939dM597872.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe   10593 Jan 10 06:18
> 1357787890.V803I33939eM865700.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe   43565 Jan 10 07:10
> 1357791044.V803I33939fM193189.mail.domain.me.net:2,
> -rw-------   1 johndoe johndoe   15492 Jan 10 07:42
> 1357792926.V803I3393a0M601349.mail.domain.me.net:2,
>=20
>=20
> The first part of the filename is unique, so I just need to substitute
> 26989.mbox:2, with V803I33939aM83469.mail.domain.me.net:2, hoping there
> will be no clash:(
>=20

sh -c 'for file in *.26989.mbox:2; do mv $file ${file%%.*}.V803I33939aM8346=
9.mail.domain.me.net:2; done'
--=20
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F132714-16C2-4E8C-8451-0E316D0E2D87>