i need to synch some files between those two systems and windows is complaining about strange filenames eg : 菅野よう子 (Macross Plus - Original Sound Track I) - 03 - After, in the dark ~ Torch Song.mp3

Did you know some nice CLI tools for that ?

  • How are you syncing the files, and what exactly is the complaint? You may find convmv to be useful (perhaps a conversion from utf-8 to an appropriate Windows code page?) – steeldriver Aug 13 '19 at 21:35
  • I'm syncing with Syncthing (syncthing.net), and i've got under Windows, incomplète synchronisation, with some files. The only thing in common is the unfriendly filenames, toolong or too UTF8 style. – freak0 Aug 14 '19 at 16:31
  • Does syncthing give you a list of the files that failed? Can you give us an excerpt of the first 10 or so on the list; does it produce a log we can use to rename the files? It might be easier to offer some options if we can see a few of the files that are problematic. Also, the exact error message(s) would be useful. – RaidPinata Aug 15 '19 at 14:53
  • Yes i got a list : Documents\Images\icons\logos\1*6Tdlelu6myAZFPD3Q2Izdw.png Games\Eve\Icons\1*c42MkKUBa0HE3th2MG8pDw.png Music\01 - Somebody Help Me (Theme from "Tru Calling").mp3 Music\20 - Fall: Marion Barfs.mp3 Removing unfriendly chars (*":) helped but i want to cronjob this to avoid futur problems. – freak0 Aug 18 '19 at 9:29

I'm paraphrasing a bit from some other answers I found here. It appears that this can be a fairly difficult problem. However there are a couple of utilities that might help. The Linux utility detox appears to be mostly Unix focused but you may be able to adjust its settings using the RC file.

The main one discussed at linked StackExchange answer appears to have a German web-page so I can't vouch for it's usability or the safety of downloading from there (since I can't read German). However, I have no reason to distrust it.

Another answer suggested using pyRenamer which also has a GUI and may be more straightforward for starting out. You may also want to try to run the copy in a way that you can generate a list of files that are failing. I'd suggest a short bash script where you copy each file separately and check the exit code to see if the copy worked. This will give you the list of files you need to rename and save you a bit of time.

My final comment would be that it is highly likely you are running into the character limit. Windows can has a character limit for the length of each file but also for the overall length of the path. It should be fairly simple to rename your files to shorter filenames using the rename utility and find such as in the second answer linked above. Unfortunately, if you have a lot of files this may take a bit of effort.

| improve this answer | |
  • I tried Detox, it does nothing ... I want to avoid GUI tools cause i want to Cronjob that part. It may be a filename char limit but for sure not a path length limit cause 3 folders with short names. – freak0 Aug 14 '19 at 16:33
  • Did you try adjusting the rc file for detox? It is unlikely to be useful unless you take some time to learn how it works. – RaidPinata Aug 15 '19 at 14:57
  • I'm using the tool with this cmd : <br/>detox -s iso8859_1 -r -v -n ./<br/>And it just print :<br/>Scanning: ./ – freak0 Aug 18 '19 at 9:38

In the end i was able to make Detox work.

With the cmd :

detox -r -v /home/user/Music/

What wasn't working :

cd /home/user/Music/    
detox -r -v ./
# The "." isn't working for Detox

detox -r -v /home/user/Music
# Detox need the trailing slash "/"

Voila. Solution from : (https://serverfault.com/questions/348482/how-to-remove-invalid-characters-from-filenames#comment1279057_871184)

| 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.