Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 12-15-2017, 02:04 AM   #1
LQ Newbie
Registered: Dec 2017
Posts: 2

Rep: Reputation: Disabled
How to RENAME files name with multiple dots (...)

Hello, recently I have discovered wonderful function like RENAME in Linux, I'm using it in script with function FIND to partly rename multiple files, for example:

find /srv/my_disk/ -type f -name '*.*' | rename 's/DVDRip/./'

after that change (and many others), new name have many dots in file name like:

Movie_Name ... 2010...avi

I wonder (because I can't do this in my way) how to remove any dot to nothing (delete all dots)?

I have tried:

find /srv/my_disk/ -type f -name '*.*' | rename '1,$s/\.\.//g'

but it doesn't work

any clue/idea?

ps. I don't wan to use any additional scripts, just use simple functions like FIND and RENAME

thanks in advance

Old 12-15-2017, 04:16 PM   #2
Registered: Dec 2011
Location: Simplicity
Posts: 898

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
Delete two or more consecutive dots
rename 's/\.{2,}//g'
rename 's/\.\.+//g'
Old 12-15-2017, 07:21 PM   #3
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
If you want to keep the last dot of file extension (.avi)
rename 's/\.{2,}(?![^.]+$)//g'
Old 12-15-2017, 07:44 PM   #4
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 28
i think sed can do it

I was as of now lazy to learn advanced bash techniques.
Old 12-17-2017, 06:57 AM   #5
LQ Newbie
Registered: Dec 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
THX 'MadeInGermany' - seams it works


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash - rename multiple files with dots in filename eldude543 Programming 20 05-20-2016 11:17 PM
[SOLVED] rename multiple files lghizoni Linux - Newbie 7 01-30-2013 08:48 AM
rename file names : replace dots by spaces, keep the extension Reda01 Programming 5 03-28-2011 08:54 AM
rename multiple files tjay1983 Programming 3 08-10-2010 12:43 AM
How to rename multiple files? Rostfrei Linux - Newbie 3 07-11-2006 06:06 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration