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

Re: Bug#258262: ITP: sortdir -- wrapper program to make files show up in sorted order



On Mon, 12 Jul 2004, Gergely Nagy wrote:

> > > > This small wrapper program will make other programs see files and
> > > > directories in a consistent, sorted order. This is e.g. usefull if you
> > > > want your tarballs to be a bit more rsyncable.
> > >
> > > How is this better than tar cvf foo.tar $(find foo | sort) ?
> >
> > I guess that if you try to do it for something ass big as the kernel
> > source tree (for example), you would exceed both the maximal number of
> > arguments and the maximal length of the command line. Moreover, that
> > would fail with oddly-named files/directories that contain spaces,
> > carriage returns or tabs in their name...

You're guessing, you said, meaning you did not try it yourself. Is it
correct?

I just did a quick test (stored the result in 2 files, run wc on them)
and got this:

 files	 words	characters
 ------- ------ ----------
 326137  326167 17231821	/tmp/sorted
 326137  326167 17231821	/tmp/raw


> That's what find foo | sort | xargs tar rvf foo.tar is for. Handles
> spaces, no command-line length overflow, no nothing, and does the same,
> methinks.

TMTOWTDI ;-)


Cheers,
Cristian



Reply to: