How to kill a dir?

Tom Mitchell mitch48 at sbcglobal.net
Tue Jan 6 01:29:01 UTC 2004


On Mon, Jan 05, 2004 at 06:09:27PM +0000, WipeOut wrote:
>
>I have a dir that I can't seem to delete and is giving strange errors..
>
>[root at dev02 i386]# ls
>ls: ??*?: Invalid or incomplete multibyte or wide character
>test

Goodness has this been solved?

I suspect two things from all the messages that went past.
	- runaway recursion creating dirs inside of dirs
	- strange characters in file names.

Permissions on the dir look funny, why?
	799767 drwxrwsr-x    3 root     root         4096 Jan  5 18:04 .

First move the problem into a scratch directory.  Wildcards may move
it along with other junk that can be moved back.  I have had to 
touch a file so globing worked when. Stuff like:

	 mkdir safer; touch AAA; mv -iv AAA ^&(&^T safer/
	 mkdir safer; touch AAA; mv -iv AAA .*T*. safer/

There are a couple tricks in find that may help
and were not mentioned in messages that passed by.
	-depth
	-print0

It might be that this works for you:

	find safer -depth -type d -print0 | xargs rm -rf
If there are lots of files in a big tree.....
	find safer -depth -type f -print0 | xargs rm -f

Start with a simple find or ls to see if you have runaway dir creation.

	ls -lRa .  | less
	find safer -print | less   
	find safer -print | od -x |less 

I find "less" more tolerant of binary junk than "more". For real junk
"od" may also help you see what is flying by.  Cat also has some flags to 
make the invisible visible.

If you have recursion from helllllllllllllllllllllllllll.  try moving
some moderatly deep part of the tree up into a second safe area. By
moving a lower part of the tree up then simple tools can get it.

	mkdir saferAA
	mv	safer/*/*/*/*/*/*/*/*/*/* saferAA
	rm -r   safer
	# if this works we are making progress.
	# heck if the mv works you have made progress.
	mv saferAA safer
	# again and again as needed.

Do not ignore the power of emacs.  'dired' mode in emacs can let you
edit seriously trashed junk file names.


-- 
	T o m  M i t c h e l l 
	mitch48-at-sbcglobal-dot-net





More information about the fedora-list mailing list