0

I accidentally created some folders with special characters. I already read the other posts in stackoverflow, but don't work. When I type the ls -la command I see

root@mycomputer:/myfolder# ls -la
drwxr-xr-x  3 root root  4096 feb  6 17:53 ,
drwxr-xr-x 70 root root  4096 feb 11 10:27 .
drwxr-xr-x  6 root root  4096 feb 11 09:16 ..
drwxr-xr-x  7 root root  4096 feb  9 22:45 (
drwxr-xr-x  3 root root  4096 feb  2 22:01 [
drwxr-xr-x  3 root root  4096 feb  6 08:11 $
drwxr-xr-x  3 root root  4096 feb  2 23:15 \
drwxr-xr-x  4 root root  4096 feb  8 10:34 &
drwxr-xr-x  5 root root  4096 feb  8 09:43 #
drwxr-xr-x  3 root root  4096 feb  6 14:41 +
drwxr-xr-x  6 root root  4096 feb  6 09:15 ?
drwxr-xr-x  4 root root  4096 feb  6 04:07 ?
drwxr-xr-x  5 root root  4096 feb  6 01:13 ?
drwxr-xr-x  3 root root  4096 feb  6 02:25 ?
drwxr-xr-x  5 root root  4096 feb  3 12:25 ?
drwxr-xr-x  4 root root  4096 feb  5 23:18 ?

I can't do anything with the ones pointed as question marks

I tried to type the command mv and then press tab and this is what I get

root@mycomputer:/myfolder# mv
,/                 ▒/                 7/                 h/
(/                 ▒/                 8/                 i/
[/                 ▒/                 9/                 j/
$/                 ▒/                 
\/                 ▒/

So apparently I can't rename them in order to delete them.

Any ideas?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
SpongePablo
  • 870
  • 10
  • 24

2 Answers2

1

What finally worked for me was one of the answers I found in this question:

rm all files except some

rm !(textfile.txt|backup.tar.gz|script.php|database.sql|info.txt)
Community
  • 1
  • 1
SpongePablo
  • 870
  • 10
  • 24
0

If you don't need the other directories, you can just

rmdir ?

Or, use character class (supported e.g. in bash):

rmdir [^789hij]  # removes all one-character directories except for 7, 9, etc.

You can also try mc or some other file manager.

choroba
  • 231,213
  • 25
  • 204
  • 289