Undeletable files

While mucking around with creating a few files in C, I've created a couple of "things" that won't go away.

Code:
> ls -l
total 2158
-rw-r--r--  1 benjamin  benjamin       62 Feb  8 21:43 ?????z?(????????HA?(?
-rw-r--r--  1 benjamin  benjamin      129 Feb  8 21:17 ?????:?(
-rw-r--r--  1 benjamin  benjamin     8028 Jan 16 21:59 Makefile
-rw-r--r--  1 benjamin  benjamin       37 Jan 23 20:55 NOTES
-rw-r--r--  1 benjamin  benjamin       27 Jan 22 20:54 categories.txt
[ snipped ]

See the top two "files"? Yeah, I can't get rid of them. I've tried quite a few things short of moving everything else (the real files) out of the directory and hosing it. Any other less brutal suggestions to try?

Before it's asked: no, rm "?????:?(" doesn't work.

Cheers.
 
Works at least for ZSH here:
Code:
% :> '?????:?('


% ls \?*             
?????:?(


% rm -v -i \?* 
remove ?????:?(? y
?????:?(


% ls \?*   
zsh: no matches found: ?*

Maybe try like that: # rm '?????:?('
 
Have you thought of using your shell's command/filename completion? Let it figure out the filename if it can.

The idea you first proposed - copying/moving the files you need and removing the directory tree - should work too.
 
You can try it with find:
Code:
find . -type -f -delete
(note this will remove all files in current directory and subdirectories!)
 
Some (many) years ago someone I worked with created a file called :
(SOUND FX beep)
with no visual part to the name.

I took some brave pills and typed:
rm -i *
then typed y after the beep.

Not for the fainthearted.
 
The safest way is to delete them by inode #. Do the $ ls -lai
Code:
[color="Red"]188417[/color] -rw-r--r--   1 mato  wheel    0 Feb 14 15:47 &&324
188416 drwxr-xr-x   2 mato  wheel  512 Feb 14 15:48 .
     2 drwxrwxrwt  14 root  wheel  512 Feb 14 15:47 ..
and remove it with find.
First check:
$ find . -xdev -type f -inum 188417 -exec ls -la {} \;
Code:
-rw-r--r--  1 mato  wheel  0 Feb 14 15:47 ./&&324
and then remove by
$ find . -xdev -type f -inum 188417 -exec rm {} \;
 
matoatlantis said:
The safest way is to delete them by inode #. Do the $ ls -lai
Code:
[color="Red"]188417[/color] -rw-r--r--   1 mato  wheel    0 Feb 14 15:47 &&324
188416 drwxr-xr-x   2 mato  wheel  512 Feb 14 15:48 .
     2 drwxrwxrwt  14 root  wheel  512 Feb 14 15:47 ..
and remove it with find.
First check:
$ find . -xdev -type f -inum 188417 -exec ls -la {} \;
Code:
-rw-r--r--  1 mato  wheel  0 Feb 14 15:47 ./&&324
and then remove by
$ find . -xdev -type f -inum 188417 -exec rm {} \;

Thank you!
 
At least some of those question marks probably aren't literal question marks, but the way the shell is showing characters that aren't in the current character set.
 
Back
Top