Results 1 to 6 of 6

Thread: How to copy files sorted by name

  1. #1
    Join Date
    Dec 2008
    Location
    Hamburg
    Posts
    458

    Default How to copy files sorted by name

    Hi,

    that problem is a bit strange:

    I own an old USB mp3 player which seems to play the files sorted as they were copied to it and not sorted by name. I didn't realize this so far since always when I copied files to it they were copied sorted by name using my old notebook (Suse 8.1). Now on my new notebook I installed everything I need to rip and copied the files to the stick. I don't know why but the Suse 11.1 doesn't copy them name by name but in a different order. E.g. it copied the files ripped from one CD like this: track14, track10, track7, track3 ... Seems to be random but it isn't cause its always the same order. I think that is a sofisitcated access to the hd or whatever. The file system is ext3 (but this also happens with reiserfs on my desktop system). I tried konquerer and mc.

    The problem is that now the stick plays track14 first, then track10 ... First I thought that the stick was broken or my lil boy messed it up and set it to random play but it is always the same. So I tried it out and copied the files one by one. After that the order was correct. So that's why I think that the problem is the stick. Is there any way to tell any file manager under linux to copy the files ordered by name?

    Bye

    Erik

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: How to copy files sorted by name

    The reason is that players usually play the tracks as they are encountered in the FAT filesystem. iPods are exceptions because they use playlists to control the order.

    I noticed this with 11.1 too. I think what's happened is that the directory access routines in the C library no longer sort the entries but output them as they occur on the disk, which is no particular order.

    I wrote a small shell script which uses cpio to do the copy using a sorted list of files from stdin.

    Code:
    #!/bin/sh
    dest="$1"
    shift
    find $* -type f | sort | cpio -pduv --block-size=128 "$dest"
    You use it like this:

    Code:
    cpsorted /media/MP3PLAYER album1 album2 ...
    where MP3PLAYER is substituted by wherever your player mounts to in /media, and the rest of the arguments are the files or directories to copy there. Take it for whatever it's worth (not much). Sorry, no GUI version.

  3. #3

    Default Re: How to copy files sorted by name

    There is utility called fatsort that reorders the files on your mp3 player:

    Homepage of FATSort Utility

    It works fine.

    I had (have) the same issue. I have to say that I ended up just getting a new mp3 player for day to day use.

  4. #4
    Join Date
    Dec 2008
    Location
    Hamburg
    Posts
    458

    Default Re: How to copy files sorted by name

    Hi,

    Quote Originally Posted by ken_yap View Post
    The reason is that players usually play the tracks as they are encountered in the FAT filesystem. iPods are exceptions because they use playlists to control the order.
    oic Never thought about it since it always worked. I'm not a multi media freak. I just want to listen music.

    Quote Originally Posted by ken_yap View Post
    I wrote a small shell script which uses cpio to do the copy using a sorted list of files from stdin.

    Code:
    #!/bin/sh
    dest="$1"
    shift
    find $* -type f | sort | cpio -pduv --block-size=128 "$dest"
    Sorry, no GUI version.
    Thanks for the script. Nice piping. I was thinking about a script too with a for loop but that's more sophisticated.

    I need no GUI for copying files. I'm a linux user. Before installing 11.1 which installed me the kAudioCreator I ripped my CDs with a self made script using cdparanoia and lame. Well, with that tool it is much easier.

    bye

    Erik

  5. #5
    Join Date
    Dec 2008
    Location
    Hamburg
    Posts
    458

    Default Re: How to copy files sorted by name

    Hi again,

    I modified your skript a bit cause it couldn't handle directory names with blanks:

    Code:
    #!/bin/sh
    
    dest="$1"
    shift
    find "$@" -type f | sort | cpio -pduv --block-size=128 "$dest"
    Thanks again. Now I'm happy and can listen to my music in the correct order.

    Bye

    Erik

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: How to copy files sorted by name

    Thanks, I should have used "$@", but I was lazy because all the media directories that I want to copy have no spaces. Glad it's of use to you.

Posting Permissions

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