[NTLUG:Discuss] True order of files in a directory.

Steve Baker sjbaker1 at airmail.net
Tue Aug 30 20:43:03 CDT 2005


Richard Geoffrion wrote:

> Ok..then why doesn't this exercise work to put the files in order.
> 
> ------------
> #Make a brand new directory
> mkdir /home/sorted
> 
> #change to the location of some unsorted files located on a different 
> file system
> cd /usr/local/bin
> 
> #list the files in the source directory in alphabetical order and do a
> # copy on each one of them in order (don't list the files in subdirs)
> for i in `ls -d *` ; do cp $i /home/sorted/ ; done
> 
> #examine the results and note they are not in alphabetical order.
> ls -fla /home/sorted
> ------------

As I said before, deleting all the files off the flash memory and copying
them all back on again *DOES* work.  But stuffing almost a gigabyte of files
across to the drive via USB every time you want to add/move/remove a file
gets old fast!

---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1 at airmail.net>    WorkEmail: <sjbaker at link.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net    http://tuxaqfh.sf.net
            http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----




More information about the Discuss mailing list