skip to Main Content

I am using CentOS and I have downloaded several videos which due to the bad internet has corrupted duplicated files with names. I want to remove them.

the files are with

file1.mp4
file1.mp4.0
file2.mp4
file2.mp4.0
file2.mp4.1
file3.mp4
file3.mp4.0
file3.mp4.1
file3.mp4.2

I want to remove all with the .mp4.0 and .mp4.1 and so on duplicated extensions.

I tried

rm *{.mp4.0}
rm *.mp4.0

but files are still there. What is the missing command part which can make the problem solved.
The file has thousands of duplicated such files and the folder contains hundreds of thousands of files.

2

Answers


  1. Since there are 2 ‘dynamic’ parts, you’ll need to use 2 wildcards


    Using rm:

    rm *.mp4.*
    

    Using find

    find . -type f -iname '*.mp4.*' -delete
    
    Login or Signup to reply.
  2. rm file*
    will remove all files that begin with "file" in a particular directory.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search