LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Two files with the same name in the same directory? (https://www.linuxquestions.org/questions/linux-newbie-8/two-files-with-the-same-name-in-the-same-directory-696558/)

RileyTheWiley 01-11-2009 03:53 PM

Two files with the same name in the same directory?
 
I am running fedora and recently interrupted an installation of some software. I restarted the install and noticed that I have two subdirectories under /tmp that appear to have identical names. I am able to rm one of them but one always persists. I cannot cd into it or remove it. I can create another directory with exactly the same name in that directory.

What's going on? How do I get rid of it?

Thanks

Riley

paulsm4 01-11-2009 04:00 PM

You are correct, they merely
Quote:

appear to have identical names
You cannot have two files or directories in the same folder with the same name.

Your best bet is to delete with wildcard.

For example, "rm -f /tmp/*xyz*" will delete file/directory "xyz" and " xyz" and "xyz " and "xyz\r\n".

'Hope that helps .. PSM

bapigoo9 01-11-2009 04:03 PM

The /tmp directory is a temporary directory. The filesystem and programs and applications use that directory. You can get information about the ownership of the directories and files with the command ls:

> man ls
> ls -l /tmp

You probably do not have the right permissions to remove the file, or the directory. In the case of a directory, it probably is not empty so can not be removed by an "rm" without the recursive option.

> man rm

colucix 01-11-2009 04:40 PM

A way to find out if a filename contains some weird character which is not visible on the terminal is to pass the output of ls to the od command. Restrict the output of ls using wildcards, for example if the "apparently" identical subdirectories are called "testdir", just issue
Code:

ls -d *testdir* | od -c
And please, post the output here (you know... we are curious)! ;)

osamaensyviswinkel 01-12-2009 05:21 AM

Are you sure they are the same? Or they don't start for example with ~ ?
Give a ls -alh output here.

Thanks


All times are GMT -5. The time now is 03:00 AM.