Operating System - HP-UX
1830935 Members
2148 Online
110017 Solutions
New Discussion

ls -l file corrupt, cannot remove

 
GTENCSS
Occasional Contributor

ls -l file corrupt, cannot remove

Hi

I have a file that appears to be corrupted because when I do a "ls" it lists all files under the directory but when I do a "ls -la" it says certain files are not found. I try to remove it with a "rm -f" and with double quotation with no luck. How can I get rid of it?
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: ls -l file corrupt, cannot remove

If you do an ls -b, the non-ascii characters will be displayed in octal; you probably have control-characters embedded in the file name.

You can do a rm -i * and you will be prompted (y or n) to remove each file. After you have removed the suspect file by tying 'y' then interupt the rm command (probably via ctrl-c) at the next file prompt to exit rm.


If it ain't broke, I can fix that.
Martin Johnson
Honored Contributor

Re: ls -l file corrupt, cannot remove

You should probably do an "fsck" on the file system to be safe. There may be more corruption than just a file name.

HTH
Marty
GTENCSS
Occasional Contributor

Re: ls -l file corrupt, cannot remove

after "rm -i" for interactive, it would come back with rm:cannot stat filename: Function is not available

Other messages for other files are:
rm:cannot stat filename: No such device or address
A. Clay Stephenson
Acclaimed Contributor

Re: ls -l file corrupt, cannot remove

In that case, it's define time to run fsck. If this is a vxfs filesystems then you almost certainly want to run the -o full,nolog options.
If it ain't broke, I can fix that.
Sandip Ghosh
Honored Contributor

Re: ls -l file corrupt, cannot remove

Do "ls -la" and redirect it to a file. Then edit that file to find out the culprit one. And then write rm -r before that file and execute that file.

Sandip
Good Luck!!!