# Undeletable files



## caesius (Feb 14, 2011)

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


```
> 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.


----------



## vermaden (Feb 14, 2011)

Try that in tcsh/csh/zsh/fish/bash:
# rm \?*


----------



## caesius (Feb 14, 2011)

```
> rm \?*
rm: No match.
```


----------



## vermaden (Feb 14, 2011)

Works at least for ZSH here:

```
% :> '?????:?('


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


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


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

Maybe try like that: # rm '?????:?('


----------



## mix_room (Feb 14, 2011)

[cmd=]rm /full/path/?????[/cmd] might work


----------



## Beastie (Feb 14, 2011)

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.


----------



## Alt (Feb 14, 2011)

You can try it with find:
	
	



```
find . -type -f -delete
```
(note this will remove all files in current directory and subdirectories!)


----------



## michaelrmgreen (Feb 14, 2011)

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.


----------



## _martin (Feb 14, 2011)

The safest way is to delete them by inode #. Do the `$ ls -lai`

```
[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 {} \;`

```
-rw-r--r--  1 mato  wheel  0 Feb 14 15:47 ./&&324
```
 and then remove by
`$ find . -xdev -type f -inum 188417 -exec rm {} \;`


----------



## caesius (Feb 14, 2011)

matoatlantis said:
			
		

> The safest way is to delete them by inode #. Do the `$ ls -lai`
> 
> ```
> [color="Red"]188417[/color] -rw-r--r--   1 mato  wheel    0 Feb 14 15:47 &&324
> ...



Thank you!


----------



## wblock@ (Feb 14, 2011)

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.


----------

