bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp alphabetical


From: Bob Proulx
Subject: Re: cp alphabetical
Date: Tue, 19 Jun 2007 10:09:01 -0600
User-agent: Mutt/1.5.9i

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]