1825775 Members
2419 Online
109687 Solutions
New Discussion

Re: Blank Directory name

 
hpuxrox
Respected Contributor

Blank Directory name

# ls -la
total 76
drwxr-xr-x 15 oracle oinstall 1024 Nov 27 09:09 .
drwxr-xr-x 5 root sys 96 Nov 16 14:41 ..
-rw------- 1 oracle oinstall 6076 Nov 20 10:22 .bash_history
-rwxr--r-- 1 oracle oinstall 1311 Oct 11 10:57 .profile
-rw------- 1 oracle oinstall 7468 Nov 27 09:33 .sh_history
drwx------ 2 oracle oinstall 96 Jun 21 13:11 .ssh
drwxrwx--- 5 oracle oinstall 96 May 10 2007 .sw
drwxr-xr-x 8 oracle oinstall 1024 Jun 7 16:25 admin
-rw-r--r-- 1 oracle oinstall 4760 Sep 4 10:30 crontab.cfg
drwxr-xr-x 5 oracle oinstall 1024 Sep 10 13:54 dbaadmin
-rw-r--r-- 1 oracle oinstall 588 Feb 23 2007 dbahome.txt
drwxr-xr-x 2 oracle oinstall 96 Feb 23 2007
-rw-r--r-- 1 oracle oinstall 3181 Nov 19 02:00 dead.letter
drwxrwxr-x 6 oracle oinstall 1024 Feb 23 2007 doc
drwxr-xr-x 5 oracle oinstall 96 May 10 2007 install
drwxrwxr-x 3 oracle oinstall 96 Feb 23 2007 jre
drwxr-xr-x 2 oracle oinstall 96 Feb 21 2007 lost+found
drwxrwxr-x 13 oracle oinstall 1024 Nov 19 14:02 oraInventory
drwxrwxr-x 6 oracle oinstall 1024 Feb 23 2007 oui
drwxrwxr-x 4 oracle oinstall 96 May 18 2007 product
-rwx--x--x 1 oracle oinstall 658 Feb 23 2007 setupenvoracle.ksh
-rwx--x--x 1 oracle oinstall 4076 Feb 23 2007 setupenvoracledba.ksh
-rwx--x--x 1 oracle oinstall 714 Feb 23 2007 setupenvroot.ksh
drwxr-xr-x 2 oracle oinstall 96 May 17 2007 work
root@prodsp1:/local/oracle


Anyone know how to view or delete this blank directory?
11 REPLIES 11
V. Nyga
Honored Contributor

Re: Blank Directory name

Hi,

have you tried to use the graphical file manager?

Volkmar
*** Say 'Thanks' with Kudos ***
Dennis Handly
Acclaimed Contributor

Re: Blank Directory name

I assume it is this one?
drwxr-xr-x 2 oracle oinstall 96 Feb 23 2007

You need to use "ll -b" to see the unprintable chars. If you can type those chars, you can use mv(1) to rename it.
Otherwise you may have to move everything else out of the directory and try using "mv * dirname" to rename it. (Provided "*" is replaced by one name.)
Mike Shilladay
Esteemed Contributor

Re: Blank Directory name

Hi,

You can use the rm -i * command and just run through answer 'n' to everything except your magic blank directory.

Mike
Robert-Jan Goossens
Honored Contributor

Re: Blank Directory name

Hi,

Search for the inode and use find to remove the directory.

$ mkdir " "
$ ls -li
total 40
43860076 drwxrwxrwx 2 BR 513 4096 Nov 27 11:37
43860036 drwx------ 2 BR 513 4096 Aug 21 07:23 Mail
43860037 drwxrwxrwx 2 BR 513 4096 Aug 22 12:09 rj
43860041 drwxrwxrwx 4 BR 513 4096 Oct 18 09:53 rjg
43860039 drwxrwxrwx 2 BR 513 4096 Aug 25 05:54 tmp
$ find . -xdev -inum 43860076 -exec ls {} \;
$ find . -xdev -inum 43860076 -exec rm {} \;
rm: ./ directory
$ find . -xdev -inum 43860076 -exec rmdir {} \;
$ ls -li
total 32
43860036 drwx------ 2 BR 513 4096 Aug 21 07:23 Mail
43860037 drwxrwxrwx 2 BR 513 4096 Aug 22 12:09 rj
43860041 drwxrwxrwx 4 BR 513 4096 Oct 18 09:53 rjg
43860039 drwxrwxrwx 2 BR 513 4096 Aug 25 05:54 tmp

Regards,
Robert-Jan
Sandman!
Honored Contributor

Re: Blank Directory name

Get the inode num of the blank directory using ll(1) and then use find(1) with the "-inum" switch to remove that blank dir as follows:

# ll -lbi
# find . -type d -inum -exec rm -rf {} \;
Geoff Wild
Honored Contributor

Re: Blank Directory name

ls -il

That will give you the inodes...

Then:

find . -inum 555555 -exec rmdir {} \;


where 555555 is the inode of the directory with no name...


Reminds me of that song...been to the desert on a horse with no name...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
V. Nyga
Honored Contributor

Re: Blank Directory name

... but maybe the content should be checked first ....
*** Say 'Thanks' with Kudos ***
John McWilliams_1
Frequent Advisor

Re: Blank Directory name

Sometimes I find that there are unprintable characters in the filename. Do the following

ls -l >>file1

Edit file1 with vi so only the filename is there.
To check do

ls -la `cat file1`

If this works then
rm -r `cat file1`

Cheers John
James R. Ferguson
Acclaimed Contributor

Re: Blank Directory name

Hi:

Be advised that inode numbers are only unique within a filesystem! Hence, you would NOT want to do:

# find / -inum 1234 -exec rm -rf {} \+

...since this would destroy every file or directory with an inode number of '1234' in EVERY MOUNTED filesystem (i.e. '/var', '/usr', etc.)

Instead, do:

# find / -xdev -inum 1234 -exec rm -rf {} \+

...to CONFINE the search to the filesystem specified.

For that matter, it is good practice to impose an interactive remove like:

# find / -xdev -inum 1234 -exec rm -ri {} \+

...to be safe.

Regards!

...JRF...
Kevin Wright
Honored Contributor

Re: Blank Directory name

ensure you supply your local directory to the find command when searching for/removing inodes.

find /local/oracle -inum ...

Also, before you -exec rm -rf, just execute the find command to list the files/inodes it finds to avoid deleting files by mistake
Dennis Handly
Acclaimed Contributor

Re: Blank Directory name

Instead of trying to remove it, the first effort should be trying to rename it as Volkmar and I have suggested. That way you don't have to do all of these complex finds.

If your directory has a space, you can simply quote it. Once I had a file with a DEL. I simply typed that, since DEL isn't special for my shell setup.