On Jul 4, 2012, at 7:01 AM, Denis Excoffier wrote:
> 
> When tar (e.g. tar-1.26) creates an archive of a directory, the
> ordering of files (as shown by "ls -f") is preserved in the archive.
> 
> I would like an option to make this ordering constant (e.g. alphanumeric),
> in order that two directories that compare equal (with "diff -r") would
> produce the same archive (provided of course that appropriate --mtime,
> --owner, --group and --mode options are also set to the same values).

Does this satisfy your requirement?

find dir | sort | tar cf output.tar -I -

The option you propose can have unpleasant implications
for tar's memory requirements.  Sorting each directory
requires first reading all the items in that directory
into memory.

Tim


Reply via email to