Directory with same names and different inode no

I am having a problem where i have two directories with same name and different inode number.I want to get rid of newer one but not sure how should i? Because when i change directory i am not sure where i get in and what i am removing:wall:

root@server # ls -lia |grep us000xyz_R5   
     42734 drwxrwxrwx  35 root     other         37 Aug 25 19:38 us000xyz_R5
     89538 drwxr-xr-x   3 oracle   dba          512 Aug 25 19:20 us000xyz_R5
 

Hi

find . -inum 42734 -exec rm -rf '{}' \;

Guru.

It is impossible to have two directories with the same name in the same parent directory.

What do you get for:

ls -lia |grep us000xyz_R5 | sed -n l     # Make control codes visible
1 Like

Hi,

Below is the out put i see when i give below command

root@us000xyz # ls -lia |grep us000xyz_R5|sed -n l

42734 drwxrwxrwx  35 root     other         37 Aug 25 19:38 us000x\
yz_R5
     89538 drwxr-xr-x   3 oracle   dba          512 Aug 25 19:20 us000x\
yz_R5

If you want the files from root user only just add one more grep to it...

ls -lia |grep root | grep us000xyz_R5

The problem i have is one of the directory contains all my project critical data and is also mounted as filesystem.The second directory i suspect is created via netbackup restore (I am not sure how) is occupying space under root filesytem and making it full.I want to get rid of second directory which is making root full.But when i change directory i am not sure which directory i am in cause is see same contents :rolleyes:

If yours is in a separate file system, its simple... just umount it what you see let is the culprit...

yes, i agree with you.That's the first thing came into my mind :D,but i don't want to do that.That filesystem is used for hosting 7 zones and un-mounting will mean i need to have production downtime :eek:

I partially understood your situation, so I donno if my answer could help you

Just cd into each dir and note down

pwd
df -h .

This info could lessen confusion

Thanks,
S.Satheesh

If I'm reading that correctly, the first entry has a tab or a bunch of spaces after a newline in the name (!?!?). Or your copy-paste went a bit wrong :slight_smile:

My prefered method of getting to the bottom of weirdness like this is the cat-vet trick:

ls -li | grep us000xyz_R5 | cat -vet

That will show you any trailing spaces (the cause of 90% of these IME) and/or other oddnesses.
You can even leave off the -li but if you want even simpler output and don't need the inode num right now.

Then you can either attack the dir by name (suggest renaming it via mv first) or by inode number as listed above (find -inum)

1 Like

Thanks a lot all and especially (Smiling Dragon ) for your reply.It really helped me i can see the space in second one after R5.So i here is what i did to remove the contents first inside it.

root@us000xyz # ls -li |grep us000xyz_R5|cat -vet
       
     42734 drwxrwxrwx  35 root     other         37 Aug 25 19:38 us000xyz_R5$
     89538 drwxr-xr-x   3 oracle   dba          512 Aug 25 19:20 us000xyz_R5 $
root@us000xyz #
root@us000xyz # cd "us000xyz_R5 " --there is space here after R5
root@us000xyz # ls -lrt
total 2
drwxr-xr-x   3 oracle   dba          512 Aug 25 19:20 test
root@us000xyz # rm -r test

Below option could have also helped but i wanted to be absolutely sure to check contents by changing directory what i am deleting :smiley: