LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Renaming a lot of files

[ILUG] Renaming a lot of files

Brian Brazil bbrazil at netsoc.tcd.ie
Wed Nov 24 18:43:10 GMT 2004


On Wed, Nov 24, 2004 at 06:21:50PM -0000, Tanney, Austin wrote:
> RDCR011_D09_2004-03-30.scf 
>  
> In this case.. I want to change the name to 
> xRDCR011_D09.scf

find -type f | xargs rename 's/^\.\/(.*)_\d\d\d\d-\d\d-\d\d\.(...)$/.\/x$1.$2/'

> Basically.. I want to remove the characters "_2004-03-30"
> Now.. these are not set characters and change for each file.
> I'm happy enough to run this as 4 processes.. i.e., one for each file type.

I'm assuming yyyy-mm-dd and 3 letter extensions. I haven't tested that
with a large number of files but it worked with 2. Alter the regex to
suit your tastes.

Brian

-- 
Website: http://netsoc.tcd.ie/~bbrazil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20041124/5f5d685b/attachment.pgp


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell