7
sudo cp -r "/home/fleamour/Music/Mum's Music" /run/media/fleamour/3732-6531
cp: cannot create regular file '/run/media/fleamour/3732-6531/Mum'\''s Music/Louis Armstrong - At His Very Best/13 - Louis Armstrong; Ella Fitzgerald _ Gee, Baby, Ain'\''t I Good To You?.mp3': Invalid argument
cp: cannot create regular file "/run/media/fleamour/3732-6531/Mum's Music/Various Artists/Good Mood Music/Disc 1 - 08 - The Four Seasons: Spring Allegro.mp3": Invalid argument...

What is the correct syntax? I am losing roughly an album's worth of music this way. This is under Konsole (openSUSE Tumblweed.)

  • 1
    You can use cp, but you need to change the filenames to avoid special characters such as * ? \ : < > | ". I will find a better question/answer to use as a reference. – Mark Plotnick Jun 25 '17 at 20:50
  • 1
    More info here at serverfault: Which common characters are illegal in Unix and Windows filesystems. If you're using a USB stick with a Windows filesystem on it, the filenames need to follow the Windows conventions. – Mark Plotnick Jun 25 '17 at 20:57
  • These were ripped with K3b, should I raise a bug? – fleamour Jun 26 '17 at 9:07
  • You could ask if they could add a feature to rename tracks to be Windows-friendly, I guess. – Mark Plotnick Jun 26 '17 at 10:37
  • Feature suggestion? FAT32 default on most car stereos. – fleamour Jun 26 '17 at 10:38
10

The syntax of your command is correct. “Invalid argument” from cp usually means that the file name is not valid on the target filesystem. It may be too long, contain a forbidden character, or be a reserved word.

For example Windows filesystems (FAT, NTFS) forbid characters such as : and ? in filenames, so you can't copy these files to a Windows filesystem. There are several workarounds:

  • Use a different filesystem (that Windows doesn't support).
  • Rename the files.
  • Only store an archive (e.g. a zip file) containing the files. Windows won't be able to unpack that archive.
  • 1
    Is there a bulk renaming app? – fleamour Jun 26 '17 at 10:39
  • @fleamour Yes there are, including two common commands called rename (with different syntax, so check which one you have). Check questions under the rename tag. – Gilles Jun 26 '17 at 11:13
  • I used krename GUI. Can you add this to your answer. Not everyone wanna use terminal, although this is blasphemous to some! – fleamour Jun 26 '17 at 12:35
  • Kid3 is perfect for this. – fleamour Jun 27 '17 at 14:51
  • Or maybe EasyTAG? – fleamour Jun 28 '17 at 21:07

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.