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

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



On Mon, Jul 12, 2004 at 04:11:51PM +0200, 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...
> 
> 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.

I guess you should add '\! -type d' to your find command. Anyway, that
won't work if some file/directory contains a newline symbol. (Using this
would be stupid, but it's legal.)


Nicolas



Reply to: