bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp alphabetical


From: Andrés Ghigliazza
Subject: Re: cp alphabetical
Date: Tue, 19 Jun 2007 15:19:16 -0300

Bob,

Thanks very much for your answer.

I use wildcards for copying alphabetical, but it would be much more
easy to copying alphabetical with -r option. I mean, I have
directories like "artist/album"; with wildcards, I can copy
alphabetical all the songs, but I have to create all the directories
before (or use a script to do that). If there was an option for
copying alphabetical, I could copy all the albums of an artist, or
various artist with one command. For example, "cp -r -alphabetical
artist1 /media/disk", would copy all the albums from artist1 at once,
alphabetically.

I know that many music players play the songs in the order of their
names, but I don't have problem with that, because my files have the
track number at the beggining of their name.

Thanks,

tizo


On 6/19/07, Bob Proulx <address@hidden> wrote:
Andrés Ghigliazza wrote:
> It would be useful to me, that cp has an option to copy files
> alphabetical.

By default cp used with shell wildcards will already copy files
alphabetically due to the shell's sorting of file globs when they are
expanded.

Example:

  mkdir test
  cd test
  touch aaa zzz bbb
  echo cp * /tmp/
  cp aaa bbb zzz /tmp/

The files presented to cp by the shell's file glob are sorted.
Is this not what you are seeing?  If not could you debug why not?

This is a feature of the shell and is influenced by the 'locale'
setting when you started the shell.  The locale setting defines the
character collation sequence sort order.

> The reason is, that there are some portable music players that, play
> the songs in the order that were copied to its flash memory.

Interesting.  Most music players that I have encountered play them in
the order of sorted filenames.  Therefore a common need is to rename
the files into "playlist" order with a leading sort-forcing string.

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]