Linux – I have a linux file with a colon in the filename that I cannot open, rename, or delete. How to remove the colon from this filename

filenameslinux

Like I said, I have a a file with a colon in the filename, but I cannot do anything with it. How can I rename this file, exclude the colon?

$ ls -l
ls: 'Colossus:_The_Forbin_Project.mp4': No such file or directory
total 1998584
-rwxrwxrwx 1 501 501 2044545396 Mar 21  2013 Colossus:_The_Forbin_Project.mp4*

EDIT:

The filesystem is ext4

Best Answer

We would better comment, but we are not that reputed yet in order to be allowed to comment.

When one character cannot be accessed due to various reasons, one should first try escaping it with a backslash character ('\').

So, the first thing that I would try would be:

mv Colossus\:_The_Forbin_Project.mp4 'Your New Beautiful Name.mp4'

UPDATE:

On a second thought, there might be nothing happening there regarding the Colon Special Character (':'). What you did was just a simple ls -l, @Brian.

The Single Quotes have been used by the Operating System in order to signal an Error related to a certain 'Colossus:_The_Forbin_Project.mp4' Missing File.

What it really succeeds in listing is a File called as Colossus:_The_Forbin_Project.mp4*.

What does this mean?

It means that somehow you have created a File that contains the Special WildCard Character called as '*'. It can be replaced by any Number of Occurrences, including Zero, of any kind of Character. It is preferable to avoid it while naming Files.

What I would do as the Next Attempt in order to solve your Little Issue is to run the following Command:

mv Colossus\:_The_Forbin_Project.mp4\* Colossus_-_The_Forbin_Project.mp4

This escapes the Star Special Character and it removes it along with the Colon Special Character.

Related Question