How to copy files in alphabetic order.

Tim Frost timfrost at xtra.co.nz
Wed Nov 23 02:45:02 UTC 2005


On Wed, 2005-11-23 at 12:30 +1100, Lex Hider wrote:
> "cp -rv somedir" doesn't copy the directories contents in alphabetic order.


No.  You have to get the shell to expand the file names, before they are
presented in alphabetic order.  That means a command like
	cp somedir/* destdir/

Or you can build a file listing the files to copy, in the order that you
want them copies, and then use a command like the following
	cp `cat files-to-copy` destdir/
NOTE: This command will copy all files into the single destination
      directory, so you lose the directory structure.




Tim





More information about the ubuntu-users mailing list