I recently transferred a backup of my CD collection from a Windows server to a new NAS. When I mount it on my Linux desktop, I'm seeing a lot of directories and files where characters with accents and Norwegian characters have been replaced by an underscore:

$ ls -al
drwx------   6 chris chris         0 juli  16 23:11 G_te
drwx------   6 chris chris         0 juli  16 23:02 Guns N' Roses
drwx------   3 chris chris         0 aug.  30 10:47 Les Mis_rables - 10th Anniversary Cast

Moving the files and directories by name or inode doesn't work, all I get are errors saying that the file can't be found. I've also tried to use convmv as suggested in other similar questions, but it doesn't list any changes to be made.

Also, folders with bad characters doesn't list any contents and files with bad filenames can't be found. Has anyone ever encountered something similar or have any suggestions? The only I can think of right now is to identify the directories/files with errors and rip the CDs again.

Update: Also checked with a Windows computer (as these files originally came from an NTFS-disk. Same issues there; I can't open directories, and if I try to rename it tells me that the directory/files no longer exists.

  • use double quote "" – c4f4t0r Nov 12 '14 at 14:19
  • Didn't work. mv "Les Mis_rables - 10th Anniversary Cast" "Les Mis" gives me an error saying that the file or directory doesn't exist. – bjelleklang Nov 12 '14 at 14:21
  • mv Les\ Mis_rables\ -\ 10th\ Anniversary\ Cast Les\ Mis , use mv Les Tab Tab – c4f4t0r Nov 12 '14 at 14:32
  • That doesn't work. In lack of a better explanation, it almost looks like ls (and any other command listing the files) displays an underscore instead of the illegal character; while any commands I try to use (regardless of how I input the bad filename; tab, copy/paste, inode) refers to the filename using an actual underscore. Thanks for the suggestions though. – bjelleklang Nov 12 '14 at 18:38
  • Your problem seems to be locale based. The actual origin locale used to write the file may have been something different from what you have set now. Discussed from a programming POV here: codesnipers.com/?q=node/68 – jim mcnamara Nov 13 '14 at 0:42

It looks like Winscp is the culprit here, as it displays all folders and files properly encoded. Not sure why this happens or what I can do to fix it yet (renaming works), but at least I know why it happens.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.