[X-Unix] Unlinking a file... illegal characters?

William H. Magill magill at mcgillsociety.org
Fri Feb 25 18:39:40 PST 2005


On 25 Feb, 2005, at 12:07, Stroller wrote:
>>> Unfortunately:
>>>
>>>   $ ls legoland/
>>>   e??y??y??y??vk??????..??????
>>>   339 /Volumes/CLEARLIGHT/foo $ ls -lFa -i legoland/
>>>   ls: e??y??y??y??vk??????..??????: File name too long
>>>   total 128
>>>   731381 drwxrwxrwx  1 stroller  admin  32768 22 Nov 03:27 ./
>>>   772975 drwxrwxrwx  1 stroller  admin  32768 25 Feb 01:53 ../
>>>   $
> Would I be over-optimistic if I suggested that a different quoting 
> method in the script might fix this? As you suggested, I thought about 
> writing a program to do the job, but I never got as far in C as 
> file-handling.

Have you tried emacs?

Since this is "legoland" something, I would assume that the file name 
is full of "foreign" (Danish) characters encoded via something other 
than utf-8.

Emacs "dired" will usually deal with all of the "weird" issues 
associated with "obscure" character sets i.e. non-ascii. It's 
particularly useful when the file name has actual embedded control 
characters in it (often inserted by hackers to prevent file discovery 
and manipulation or removal).

For one thing, it will usually have no trouble reading the "long lines" 
and then getting the appropriate inode information to do the deletion 
with.

cd to the directory involved.
launch emacs
type "escape-x-dired" and just hit return when it asks for the 
directory.

You can then use the arrow keys to navigate down the lines of the 
buffer.
Select one file and press "d" ("u" is the inverse) and a "D" will 
appear in the left margin.
Type  "x" and emacs will prompt
delete "....." (yes or no)
type "yes"

If the process is successful, then do another or several more.

To exit emacs type "cntl-x cntl-c"


T.T.F.N.
William H. Magill
# Beige G3 [Rev A motherboard - 300 MHz 768 Meg] OS X 10.2.8
# Flat-panel iMac (2.1) [800MHz - Super Drive - 768 Meg] OS X 10.3.7
# PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg] Tru64 5.1a
# XP1000  [Alpha 21264-3 (EV6) - 256 meg] FreeBSD 5.3
# XP1000  [Alpha 21264-A (EV 6.7) - 384 meg] FreeBSD 5.3
magill at mcgillsociety.org
magill at acm.org
magill at mac.com
whmagill at gmail.com



More information about the X-Unix mailing list