Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2004 22:57:34 -0500
From:      Parv <parv@pair.com>
To:        Walter <walterk1@earthlink.net>
Cc:        'Questions' <freebsd-questions@FreeBSD.org>
Subject:   Re: deleting directories with ??? in name
Message-ID:  <20040316035734.GC3419@moo.holy.cow>
In-Reply-To: <40564606.3020504@earthlink.net>
References:  <405640BE.9000102@earthlink.net> <A99A5AC30F74624388EE5F757BA58A20D7A27C@RED-MSG-50.redmond.corp.microsoft.com> <20040315235943.GA55958@falcon.midgard.homeip.net> <40564606.3020504@earthlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <40564606.3020504@earthlink.net>,
wrote Walter thusly...
>
> Erik Trulsson wrote:
>
> > ls(1) by default displays all unprintable characters as question
> > marks.  To see what the filenames actually are use 'ls -aB'.
> >
> > To delete files with strange names you can always do a 'rm -i *'
> > and answer 'y' only for the weird files.
>
> 'rm -i *' returns "no match"
> 'ls -aB' shows me the file names, but even after carefully typing
> in what it shows me in an 'rm' command (name in quotes) says not
> found.  There are \216, \235, \237, and \377 characters in the
> names


Use the inodes, find(1) & xargs(1) instead to remove the files...

  - Use '-i' option of ls(1) to list the inodes of the offending
    files; note them.  These are listed in the most left hand
    column.

    #  ls -iaB1


  - Find(1) the files matching above inodes (assuming evil files are
    in current directory & inode-1 & inode-2 are the inodes of two
    nasty files) ...

    # find . \( -inum <inode-1> -o -inum <inode-2> \) -print0


  - Pass the find(1) output to rm(1) ...

    # find . \( -inum <inode-1> -o -inum <inode-2> \) -print0 \
    # | xargs -0 rm -fv


  - Done


...Read up on ls(1), find(1) & xargs(1).


  - Parv

-- 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040316035734.GC3419>