Are there any invalid linux filenames?

前端 未结 3 1416
北海茫月
北海茫月 2020-12-05 06:13

If I wanted to create a string which is guaranteed not to represent a filename, I could put one of the following characters in it on Windows:

\\ / : * ? | &l         


        
3条回答
  •  失恋的感觉
    2020-12-05 06:52

    I personally find that a lot of the time the problem is not Linux but the applications one is using on Linux.

    Take for example Amarok. Recently I noticed that certain artists I had copied from my Windows machine where not appearing in the library. I check and confirmed that the files were there and then I noticed that certain characters in the folder names (Named for the artist) were represented with a weird-looking square rather than an actual character.

    In a shell terminal the filenames look even stranger: /Music/Albums/Einst$'\374'rzende\ Neubauten is an example of how strange.

    While these files were definitely there, Amarok could not see them for some reason. I was able to use some shell trickery to rename them to sane versions which I could then re-name with ASCII-only characters using Musicbrainz Picard. Unfortunately, Picard was also unable to open the files until I renamed them, hence the need for a shell script.

    Overall this a a tricky area and it seems to get very thorny if you are trying to synchronise a music collection between Windows and Linux wherein certain folder or file names contain funky characters.

    The safest thing to do is stick to ASCII-only filenames.

提交回复
热议问题