Operating System - HP-UX
1834325 Members
3242 Online
110066 Solutions
New Discussion

two directory with the same name

 
VIKAS AGRAWAL
Frequent Advisor

two directory with the same name

I Have a system loaded with HPUX-11.23, it is showing two directory under root with the name pamdb
1. If i give ls -l pamdb , i found only one directory .
2. If i give ls -il , it shows me 2 directory with diff inode number.
3. i tried to remove directory pamdb & after that i found no directoy by ls -l pamdb , but i found one by ls -l , if tried to give ls -il then i am getting one directory at inode entry 2365.

I have tried clri command to clear this inode entry , but it only works on hfs file system , I checked the i node entry by ncheck ,it is under / file system lvol3.

Can u give me some command to remove this file from Inode database.
18 REPLIES 18
Bhushan Bumber
Frequent Advisor

Re: two directory with the same name

Hello vikas,
These two directories are not with the same name.May be while creating any of the directory u have pressed a space so that directory is with the name plus space.
I faced the same problem once.Please chech which directory has a space after the name.
Ciaoo
Bhushan
There is a solution to every problem.
Vibhor Kumar Agarwal
Esteemed Contributor

Re: two directory with the same name

There can be some control characters also.

ls -b
will print control characters also.
Vibhor Kumar Agarwal
CAS_2
Valued Contributor

Re: two directory with the same name

try

ls -d /pam* | xd -tx1 -tc

and check its output.


Other trick is:

ls -d ????? # this command will print the true pamdb directory. The false one would have more than 5 chars.
RAC_1
Honored Contributor

Re: two directory with the same name

There may be control chars in the file name.
ll | vis
ll -b
ll | cat -v

check control/non-prinable chars and then you can remove it as follows.
ls -il *
check inode number for those files.

find . -inum "inode_number" -exec rm -r {} \;
There is no substitute to HARDWORK
florence mathon lermusi
Trusted Contributor

Re: two directory with the same name

If you want to figure out which filename has a space encompassed, you can try this.

first get your inode number with any command, and then :

FILE=`find . -inum yourinode -print`; echo ${FILE}A

regards

fl
VIKAS AGRAWAL
Frequent Advisor

Re: two directory with the same name

Hi,

I have done all these checking , all these thins are ok. No extra space or control character, This kind of issue i am able to see first time in my carrier.

In my previous mail also i have written that One directory is just the dummy thing with a inode entry 2365.

I just want to remove that I node entry. This is might has happened due to system crash.

Please revert back how to clear the inode entry.
Robert-Jan Goossens_1
Honored Contributor

Re: two directory with the same name

Hi,

# cd /
# find . -inum 2365 -exec mv {} /tmp/vikas \;

Regards,
Robert-Jan
florence mathon lermusi
Trusted Contributor

Re: two directory with the same name

so, the find command given by RAC should be the one
CAS_2
Valued Contributor

Re: two directory with the same name

Please,

would you mind your posting the output of commands requested ?
CAS_2
Valued Contributor

Re: two directory with the same name

About the "find" command line suggested by
Robert-Jan Goosens.
I think -xdev option is very important to be used:

# cd /
# find . -xdev -inum 2365 -exec mv {} /tmp/vikas \;
Raj D.
Honored Contributor

Re: two directory with the same name

Hi Vikas ,

You can try ,

1.# ls -i | grep pam
[ not down the inode nos. of both.]
# ls -b | grep pam [ You may find any diff ]

If no difference , then proceed to 2.

2. Check both the dir , as per inode :

# find . -type d -xdev -inum xxx -print
# find . -type d -xdev -inum yyy -print

[ xxx and yyy are the indoe number of the two dir. ]

[ Any difference ! ]

3. You can compare the size also , to make sure they are really exists and you can move or delete :

#find . -type d -xdev -inum xxx -exec du -sk {} \;
#find . -type d -xdev -inum yyy -exec du -sk {} \;

And then you can move using mv with find.

Hope this will help ,

Cheers,
Raj.D.
" If u think u can , If u think u cannot , - You are always Right . "
VIKAS AGRAWAL
Frequent Advisor

Re: two directory with the same name

Hi All,

Thanks for replying , Today i am going to customer place & from there i will send u output of all the commands u ppls are asking.

When customer has reported this problem to me that time i also suggested him all these things & once i reached at customer site, i found this is just a secound dummy name u can noy move , delete or copy this directory , But when u give ls u will find it.

Any how will get back to all u ppls with output of these commands .
VIKAS AGRAWAL
Frequent Advisor

Re: two directory with the same name

Hi All ,

Find command with inum works fine & i deleted that directory successfully ,

Thanks all for your replies ,
VIKAS AGRAWAL
Frequent Advisor

Re: two directory with the same name

find command worked fine with inum & i was able to delete the directory
Raj D.
Honored Contributor

Re: two directory with the same name

Hi Vikas ,

Nice to know that with find and inum you can able to delete it . Cheers.

Also found that you have given 1 points to each , initially I thought it is 10 , but found 0 is vanished.

Giving 1 point each , it seems that you have not got any help from this thread , and may be not happy.

Cheers,
Raj.D.

" If u think u can , If u think u cannot , - You are always Right . "
VIKAS AGRAWAL
Frequent Advisor

Re: two directory with the same name

Hi Raj & All others who replied

I am sorry for that, this was my first chance to give points, I have given one point to each one who replied & i was planning to add points to those ppls who's solution works for me, but after that site has not allowed me to change the already assigned points. Hope u understand.
Vibhor Kumar Agarwal
Esteemed Contributor

Re: two directory with the same name

No problem.

You are most welcome.
Vibhor Kumar Agarwal
Raj D.
Honored Contributor

Re: two directory with the same name

No Problem,

Keep your queries posted ,
Enjoy and Have fun.

HTH.
Raj.D
" If u think u can , If u think u cannot , - You are always Right . "