Problem deleting file with file named with a wrong codepage (U16) and special characters

Files named with wrong code page can be saved, but not deleted under the linux file system.

Example: my doughter saved a file she got by e-mail from a friend. The file was saved, but now a cannot delete it anymore :’(.

Do you have a suggestion on how to solve the problem? rotfl!

You should be able to do it by inode (Well at least I would of thought so) How to: Linux / UNIX Delete or Remove Files With Inode Number

…or convert it to the right charset / encoding by using ‘convmv’:

convmv -f ISO-8859-1 -t UTF-8 -r --notest /path/to/file

I’m not quite sure whether convmv comes by default, if not, you can install it from the ‘oss’-repository.

In case one has to convert important files, I recommend to run this command without the ‘–notest’-option first.

Thanks for the instructions.

As first I tryed the method with convmv. The result was as follows:

dieter@BueroVatiPC:~> convmv -f ISO-8859-1 -t UTF-8 -r --notest “/home/irina.a/Picnik-Collage ir���.jpg”
file or directory not found: /home/irina.a/Picnik-Collage ir���.jpg

The same problem as when trying to delete from the KDE desktop. The file name is not regognised by the filesystem.

Now I will try with the method using the inode number.

I’ll let you know.

Trying with the inode method:

dieter@BueroVatiPC:~> stat “/home/irina.a/Picnik-Collage ir���.jpg”
stat: Aufruf von stat für „/home/irina.a/Picnik-Collage ir���.jpg“ nicht möglich: Datei oder Verzeichnis nicht gefunden

The problem is not solved.

You can use wildcards with convmv:

convmv -f ISO-8859-1 -t UTF-8 -r --notest /path/to/some_fil*

Tahnks, but it does not work either:

dieter@BueroVatiPC:~> convmv -f ISO-8859-1 -t UTF-8 -r --notest "/home/irina.a/Pic*."
file or directory not found: /home/irina.a/Pic

Don’t use quotation marks, they’re needless.

convmv -f ISO-8859-1 -t UTF-8 -r --notest /home/irina.a/Picnik*

When you only want to remove it, no conversion is needed. First do

ls -l /home/irina.a/Picnik*

to check that only one file (the one to be removed) fits to the wild card. Then

rm /home/irina.a/Picnik*

will delete it.

:slight_smile: Thanks a lot to all who tryed to help me: it worked.

What I learned: use the console, use wildcards in place of the special characters.

Case is solved. rotfl!

Nice it worked.

Next problem: try to delete a file where the name starts with a - sign like


. :slight_smile: