[X-Unix] Unlinking a file... illegal characters?
Robert Tillyard
rob2 at atvetsystems.com
Sat Feb 26 05:55:26 PST 2005
Here is some 'C' code that I have used to find the i-node, just copy it
to a file with a .c extension such as inode.c then type make inode and
then run ./inode <path> from the terminal.
-------------- next part --------------
#include <stdio.h>
#include <dirent.h>
static int doDirectory (char *);
int main (int argc, char **argv)
{
int i;
if (argc == 1)
return (doDirectory ("."));
for (i = 1; i < argc; i ++)
doDirectory (argv [i]);
return (0);
}
static int doDirectory (char *name)
{
struct dirent *dir;
DIR *dirp;
if ((dirp = opendir (name)) == (DIR *) 0L)
{
perror (name);
return (-1);
}
while (dir = readdir (dirp))
{
printf ("%-30.30s ", dir->d_name);
if (dir->d_ino == 0)
printf ("<deleted>\n");
else
printf ("%lu\n", dir->d_ino);
}
closedir (dirp);
}
-------------- next part --------------
Regards, Rob.
On 26 Feb 2005, at 11:11 am, Stroller wrote:
>
> On Feb 26, 2005, at 2:39 am, William H. Magill wrote:
>>
>> 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?
>> ...
>> 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).
>> ...
>> 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)
>
> Unfortunately it doesn't allow me to identify the file.
> Results shown at <http://mac.stroller.uk.eu.org/Emacs.gif>
> Mr Dyballa has already suggested a reason in his posting of Feb 25,
> 2005, at 10:26 am.
>
>> 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.
>
> It's part of a big back-up of a customer's PeeCee, the rest of which
> was zipped, burned to DVD & deleted. It was originally in "Program
> Files", and I'm sure that this is just some file from the installation
> of one of the Lego-branded computer games. Since I regularly back-up
> PCs' whole C: drives to my portable drive by booting to a Linux liveCD
> & using `cp -Rvf ...` many thousands of files might be copied on & off
> this drive each week - my guess is simple filesystem corruption.
>
> Stroller.
More information about the X-Unix
mailing list