Search code examples
linuxdirectoryspecial-charactersrename

Remove folder with special character on it


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?


Solution

  • 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)