Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Error transferring .mp3 files to USB drive and NAS.

  1. #1
    drhedberg NNTP User

    Default Error transferring .mp3 files to USB drive and NAS.

    Greetings,

    I'm running openSUSE 13.2 64-bit and just ripped 100 cd's with K3b to .mp3 but when I try to copy some of them to a USB drive or my NAS for back-up I get an error saying it can't be copied. It appears that some of the folders and .mp3 files that were created by K3b have a "?" or a ":" in the name and when I rename the folder or file without these two symbols they transfer successfully. There are about 1,500 .mp3 files and probably half of them have these symbols in the name. I am using Dolphin and have tried to copy and paste as well as selecting all and "copy to" both drives with the same errors.

    Is there a way to copy these files without going in and manually renaming hundreds of files?

    Thank you in advance because any possible solution would save me a lot of time.

  2. #2
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,450

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Just guessing that the USB and NAS are formatted using a filesystem which does not accept certain characters in a filename; eg. : delimits drivename and filename in Windows filesystems.

  3. #3
    drhedberg NNTP User

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Thanks John. It appears that Fat32 filesystems will not accept : or ? in the file name.

    Do you or does anyone know how to remove the : and ? from all of the files so I don't have to rename each one manually?

    thanks

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,608
    Blog Entries
    3

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Quote Originally Posted by drhedberg View Post
    Thanks John. It appears that Fat32 filesystems will not accept : or ? in the file name.
    That happens, also, with NTFS file systems, and probably any other Windows file system.

    I uploaded a shell script that I use, to susepaste.org

    I left it at the default expire (one week or a bit less).

    I call it "decolonize", with the intended double meaning. Put it in your $HOME/bin and give it executable modes. If you call it without arguments, it gives a brief help line. Beyond that, you will have to read the script to work out how to use it.

    I don't think it uses anything that would not be in a normal install. Use at your own risk. (Written by me, so consider it to be in the public domain).
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  5. #5
    drhedberg NNTP User

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Thank you so much for posting this shell script! I have never used a shell script and my linux skills are the beginner level so I need a little more instruction if possible.

    I copied and pasted the shell script into kate text editor and saved it as an .sh in the bin folder in my home directory and made it executable. All of my music is in the Music folder in their respective sub-folders for each album.

    Can you help with where to go from here because I'm not sure what to do at this point with the shell script.

    thank you for your patience

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,608
    Blog Entries
    3

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Quote Originally Posted by drhedberg View Post
    Can you help with where to go from here because I'm not sure what to do at this point with the shell script.
    Go to the directory where the files are. And then use the command:
    Code:
    decolonize.sh *
    ### or
    decolonize.sh -s _ *
    The first version should rename all files contain ":" in the name, by deleting the ":". The second form should instead replace ":" by "_".

    To act on a different character such as "?", use
    Code:
    decolonize.sh -c"?" -s _ *
    You probably need those quotes around the "?", because that character has a special meaning to the shell.

    The "*" at the end of the line (and do not quote that) matches all files in the current directory. So you should be able to rename all in one step unless the directory is very very big.

    If you prefer, you can rename the command to just "decolonize" (without the ".sh") making it slightly shorter to type the command name.

    I wrote that script for my own mp3 collection (ripped with k3b). The only testing is with my own files.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  7. #7
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,742

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    The line

    ### DECOLONIZE - remove colons from file name
    # -d (default) delete the colon (or other) character
    # -s x replace colon (or other) with substitute x.
    # -c y the character to replace (defaults to ':')


    USAGE="decolonize [-d -s x -c y ] file"

    pretty much tells you all you need


    So the stuff in [] are optional parameters that change how things work. file is the full path to the file or start in target directory. Note it appears that this only operates on one file at time so something like

    ls *.mp3 | decolonize

    This pipes ( | char means pipe) the output of the ls (list) command to the decolonize command. You can add the additional parameters if needed

  8. #8
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,608
    Blog Entries
    3

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    Quote Originally Posted by gogalthorp View Post
    ls *.mp3 | decolonize
    That won't work if there are spaces in the file names. And there probably are. Hmm, it won't work anyway, because the file names are expected to be arguments, not stdin.

    So just:

    decolonize.sh *.mp3

    (since he named it "decolonize.sh").
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  9. #9
    drhedberg NNTP User

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    This is truly amazing nrickert and thanks for the additional clarification gogalthorp. I went into my Music directory and it worked like a charm for the 105 folders that I have. In order for me to make changes for each .mp3 file however I think I have to go into each album's folder and run the script. I just tried it and it worked for all of the files in a single directory.

    I don't mind going into all 105 folders and running the script which shouldn't take too long but as a learning experience I would like to know if I can run the script for all of the directories(albums) within the main Music directory so it corrects all of my .mp3 files?

    Thank you again for this script, it's my first time using one and it really shows me the power of linux.

    thanks

  10. #10
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,608
    Blog Entries
    3

    Default Re: Error transferring .mp3 files to USB drive and NAS.

    You can probably go to the top directory of the collection, and use:

    Code:
    find . -name '*.mp3' | xargs decolonize
    Change that to "decolonize.sh" if that is still the script name you are using. And you can add other options after the "decolonize".

    And now you will need: man find
    to find out about the "find" command and the "xargs" command.

    Yes, unix can be very powerful.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •