deleting directories with ??? in name
Parv
parv at pair.com
Mon Mar 15 20:03:06 PST 2004
in message <40564606.3020504 at 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
--
More information about the freebsd-questions
mailing list