Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Question: How to replace multiple dots in file name only ignoring file extension? #37

@r4dh4l

Description

@r4dh4l

Hi,

I would like to replace/remove multiple . in a file name like test1.test2.test3.test4.flac.

I started with rnm -rs '/\.//g' ./* which replaces every . but the result is test1test2test3test4flac.
Then I tried rnm -rs '//n/./_/' ./* but this replaces the whole file name with an underscore so the result is _flac.

In this context I think the chapter https://neurobin.org/docs/unix/rnm/bulk-rename-in-linux/#12-applying-uppercase-lowercase-conversion-on-filenames-partially is a little bit misleading for me:

Now, lets change the case of filenames without the extensions, i.e .jpg, .png should be intact. To do that we will have to select the part before the last . and replace it ...

But rnm -rs '/.*\./_/' ./* replaces the whole file name except the extension. So maybe the quoted sentence should not say "the last ." but only "the .".

However: Is it possible to remove multiple dots in the file name without the extension dot?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions