Operating System - HP-UX
1846936 Members
8011 Online
110257 Solutions
New Discussion

Re: Problem removing a file

 
SOLVED
Go to solution
Jeff Picton
Regular Advisor

Problem removing a file

Hi

I have a file (apparently) on my system which I ftp'd to it but I cannot chown, remove, move, perform a file type on it.

Can anyone explained ?

Jeff
14 REPLIES 14
Robert-Jan Goossens
Honored Contributor

Re: Problem removing a file

Hi Jeff,

can you ls the directory on post the output.

Robert-Jan
Steve Steel
Honored Contributor

Re: Problem removing a file

Hi

can you ll -d the file.

What message do you get

try ll -d file|od -c
to look for odd characters in name

Maybe it is open

Get lsof from public domain

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Declan Heerey
Frequent Advisor

Re: Problem removing a file

Silly question but how do you know the file is there? has the ftp been sucessful? is the file definately on the server?
Bryan D. Quinn
Respected Contributor

Re: Problem removing a file

Are you logged in as root?

Did you drop it into an NFS'd file system?

-Bryan
Jeff Picton
Regular Advisor

Re: Problem removing a file

ls -l

-rw-rw-r-- 1 root sys 153 Dec 5 14:18 EGRR.dat
Patrick Wallek
Honored Contributor

Re: Problem removing a file

What user are you logged in as when you are trying to do this? If you are not logged in as root, then it sounds like you just don't have the appropriate permissions to do anything.

If you are logged in as root, then the file may not be named what you think it is. There may be some special (non-printable) characters in the file name that you are not seeing.

Do an 'ls -b' in the directory you think the file is in. The '-b' option will print octal values (like /057) for non-printable characters in the file name. So if you see something like that, you have a file name issue.

Helen French
Honored Contributor

Re: Problem removing a file

There might be some additional characters with that file (spaces, tabs etc). You can use the wild card characters when using the commands:

# chmod 700 file_name*
# rm -i file_name*
# file file_name*
Life is a promise, fulfill it!
Mark Grant
Honored Contributor
Solution

Re: Problem removing a file

You probably have funny characters in the filename.

try "ls > tempfile" and then vi the result. You should see all the funny characters. Edit out all the other filenames and insert "rm " in from of the funny one. Then "sh testfile".

Alternatively, "rm -i *" and answer "n" to everything except the dodgy one.
Never preceed any demonstration with anything more predictive than "watch this"
Robert-Jan Goossens
Honored Contributor

Re: Problem removing a file

# ls -i

find the inum above

# find . -inum xxxx -exec mv {} tempfile \;

Regards,
Robert-Jan
Jeff Picton
Regular Advisor

Re: Problem removing a file

Hi all

Many thanks for all this useful info.

I ended up doing the simplest option and did rm -i an answering yes to the dodgy one.

Jeff
Sanjay_6
Honored Contributor

Re: Problem removing a file

Hi Jeff,

The filename probably has a control character or two in it and that could be the reason you are unable to do anything with it. do a ll >some_file_name and vi this file. If there are control character with the file name you should see it over there.

Hope this helps.

Regds
Todd McDaniel_1
Honored Contributor

Re: Problem removing a file

one other way to remove might work using autocomplete feature.

type rm ./filename then hit esc 2x to expand the filename this sometimes works.

I used to knwo a way to show the control characters, but forgot the method.


also, you cna do ll -i and remove based upon the Inode value.
Unix, the other white meat.
Bill Hassell
Honored Contributor

Re: Problem removing a file

Whenever you can 'see' a file but not rename or move it, the problem is almost always control characters imbedded inthe file name. To see these special chars, use ls -lb and you'll see the problem.


Bill Hassell, sysadmin
Jim Butler
Valued Contributor

Re: Problem removing a file

or
ls -l | cat -v


if your file is like testxxxx
where xxx are control chars,
mv test* testit
that will clear the bad characters -

if the filename is blank, then you may want to check the control chars -
lets say they are like ^C^C^C -
just move it or delete it with

mv "^C^C*" test.file

then check the contents, rename it to what you want, or delete it...

good luck

Man The Bilge Pumps!