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

Stroller MacMonster at myrealbox.com
Fri Feb 25 09:07:32 PST 2005


On Feb 25, 2005, at 4:06 pm, Brian Medley wrote:

> On Fri, Feb 25, 2005 at 09:37:58AM +0000, Stroller wrote:
>
>> Thank you - this is exactly what I had in mind, except that I =
couldn't
>> see the -1 option in `man ls`.
>>
>> 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 ../
>>   $
>>
>> Can you suggest any other way to find the inode number?
>
> Might try this:
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> MAIN:
> {
>     opendir(DIR, ".") or die "error: opendir: $!\n";
>     my @files =3D readdir(DIR);
>     close(DIR);
>
>     foreach my $f (@files) {
>         my $inode =3D (stat($f))[1];
>
>         print "$f: $inode\n";
>     }
>
>     exit 0;
> }

:(

   $ ./inodes.pl
   .: 224409
   ..: 25105
   .bash_history: 225308
   .bash_profile: 605048
   .bashrc: 605034
   .CFUserTextEncoding: 224419
   .DS_Store: 224620
   .irssi: 1032016
   .lpoptions: 624653
   .mplayer: 583432
   .profile: 445041
   .ssh: 224985
   .Trash: 224614
   .viminfo: 1034823
   Applications: 605115
   Desktop: 224420
   Documents: 224422
   foo: 420235
   Library: 224410
   Movies: 224460
   Music: 224462
   Pictures: 224464
   Public: 224466
   Sites: 224470
   Stuff: 400314
   inodes.pl: 1035526
   $ cd /Volumes/CLEARLIGHT/foo/legoland
   $ ~stroller/inodes.pl
   .: 731381
   ..: 772975
   Use of uninitialized value in concatenation (.) or string at=20
/Users/stroller/inodes.pl line 15.
   e=ED=A5y=ED=C3y=ED=C3y=ED=C3vk=89=C6=A5=89=C6=A5..=89=C6=A5=89=C6=A5:
   $

Would I be over-optimistic if I suggested that a different quoting=20
method in the script might fix this? As you suggested, I thought about=20=

writing a program to do the job, but I never got as far in C as=20
file-handling.

Stroller.



More information about the X-Unix mailing list