[svlug] re-ordering entries in FAT directories

Rick Schultz bloodyvikings at sbcglobal.net
Fri Aug 30 17:08:06 PDT 2002

> The player unfortunately doesn't sort by filename when it plays, so the
> play order is random too, which works very badly for albums where order
> matters.

I remember having this problem with xmms.  I eventually gave up on trying
to maintain proper order in the directory itself and moved to a set of
bash functions that handled everything.  Something like:

    function eshow () {  # 'e' like "egrep"
        locate mp3| grep mp3\$ | grep -v /mp3\$ |
        egrep -i "$*" |
        sort | sed 's/^/"/;s/$/"/;'
    function eplay () {
        eshow $* |
        ( read x ;
            if [ ! -z "$x" ] ; then
                eval "xmms $x";
            fi  ;
            xargs  -r xmms -e )

It's not too elaborate, but at least I can type `eplay dark side` and
listen to some Floyd.  Or `eplay .` and get everything locate can find.

> Is  there a  program  that can  recurse through  directories,  take all  the
> entries  and re-sort  them (probably  by  copying all  the files  to a  temp
> filename in the  order they need to  be in the directory,  and then renaming
> them)

I had some luck (before I gave up) using cpio.

   $ find /src/dir | sort | cpio -pvd /dest/dir

I seem to recall it working for me (in terms of programs that didn't sort
by filename getting the list in the proper order), but no guarantees.  It
might work for you, but you'd need a bit of spare space on the filesystem.


 Rick                This space intentionally          bloodyvikings@
 Schultz                   left blank                  sbcglobal.net

More information about the svlug mailing list