From: Bob Melson on
On Sunday 06 June 2010 18:39, MZ (mark(a)nospam.void) opined:

> Tim Daneliuk wrote:
>> On 6/6/2010 5:53 PM, MZ wrote:
>>> I'm trying to remove a directory, but some of the files remain and it
>>> gives me the error "illegal byte sequence". How do I get rid of these
>>> files?
>>
>> I've never seen that error, but I wonder if it has something to do with
>> the file names you're trying to get rid of. It may be that rm is
>> interpreting
>> them as args or something. Try this:
>>
>> rm -rf -- dir
>>
>> Otherwise these feels like some kind of Unicode silliness...
>>
>
> Same error.
>
> I don't know if it's worth mentioning, but this folder was the /usr
> directory copied onto FreeBSD 8 from a FreeBSD 7.2 install. The
> specific problem directory is usr/local/lib/gcc-4.3.4/ ...

Can you cd into the directory? If so, do that, then "rm -rf *". If
_that_ completes without error, "cd ..;rm -rf <your_directory_name>. If
it _doesn't_ complete without error and there are sub-directories, cd into
each of _them_ and do the rm -rf business for each.

Doesn't sound to me like there's an easier way to solve your problem.

Bob

--
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
-----
Nothing astonishes men so much as common sense and plain dealing.
Ralph Waldo Emerson

From: Indi on
On 2010-06-07, MZ <mark(a)nospam.void> wrote:
>
> # rm -rf "CupsIppOperation.h"
> rm: CupsIppOperation.h: Illegal byte sequence

chflags?

--
Caveat utilitor,
indi

From: Bob Eager on
On Sun, 06 Jun 2010 20:39:10 -0400, MZ wrote:

> Tim Daneliuk wrote:
>> On 6/6/2010 5:53 PM, MZ wrote:
>>> I'm trying to remove a directory, but some of the files remain and it
>>> gives me the error "illegal byte sequence". How do I get rid of these
>>> files?
>>
>> I've never seen that error, but I wonder if it has something to do with
>> the file names you're trying to get rid of. It may be that rm is
>> interpreting them as args or something. Try this:
>>
>> rm -rf -- dir
>>
>> Otherwise these feels like some kind of Unicode silliness...
>>
>>
> Same error.
>
> I don't know if it's worth mentioning, but this folder was the /usr
> directory copied onto FreeBSD 8 from a FreeBSD 7.2 install. The
> specific problem directory is usr/local/lib/gcc-4.3.4/ ...

Get the inode number for the directory, and clri(8) it? Then fsck.

Drastic, but worked for me...even back on v6.



--
Using UNIX since v6 (1976)...

Use the BIG mirror service in the UK:
http://www.mirrorservice.org
From: David Malone on
MZ <mark(a)nospam.void> writes:

>I'm trying to remove a directory, but some of the files remain and it
>gives me the error "illegal byte sequence". How do I get rid of these
>files?

"Illegal byte sequence" sounds like a locale related error. You could
try clearing running rm with a clear environment:

env - rm -fr -- directory

David.
From: Mike Clarke on
Bob Eager wrote:

> On Sun, 06 Jun 2010 20:39:10 -0400, MZ wrote:
>
>> Tim Daneliuk wrote:
>>> On 6/6/2010 5:53 PM, MZ wrote:
>>>> I'm trying to remove a directory, but some of the files remain and it
>>>> gives me the error "illegal byte sequence". How do I get rid of these
>>>> files?

[snip]

>> I don't know if it's worth mentioning, but this folder was the /usr
>> directory copied onto FreeBSD 8 from a FreeBSD 7.2 install. The
>> specific problem directory is usr/local/lib/gcc-4.3.4/ ...
>
> Get the inode number for the directory, and clri(8) it? Then fsck.
>
> Drastic, but worked for me...even back on v6.

Having got the inode number this might work, but only for deleting a single
file at a time ...

find . -inum nnnn -delete

or, more cautiously

find . -inum nnnn -ok rm {} \;

.... this approach has often got me out of a hole when dealing
with "impossible" file names.

--
Mike Clarke