On 11/07/2012 04:38 AM, Joerg Schilling wrote:
John Stanley <[email protected]> wrote:
Hi,
I was wondering if it would be possible in the 'skip-old-files' option
warning messages, to have a distinction made between existing files and
existing directories, i.e., instead of, e.g., printing:
tar: ./usr/local: skipping existing file
print:
tar: ./usr/local/: skipping existing directory
This would make it much easier to parse existing files and existing
directories. I have been using the following simple patch to handle
this in my work:
+++ tar-master-1.26.90.new/src/extract.c 2012-11-06
18:18:28.853013706 -0500
@@ -644,8 +644,12 @@ maybe_recoverable (char *file_name, bool
switch (old_files_option)
{
case SKIP_OLD_FILES:
- WARNOPT (WARN_EXISTING_FILE,
- (0, 0, _("%s: skipping existing file"), file_name));
+ if (current_stat_info.had_trailing_slash)
+ WARNOPT (WARN_EXISTING_FILE,
+ (0, 0, _("%s/: skipping existing directory"),
file_name));
+ else
+ WARNOPT (WARN_EXISTING_FILE,
+ (0, 0, _("%s: skipping existing file"), file_name));
return RECOVER_SKIP;
case KEEP_OLD_FILES:
A directory is determined by checking for the directory type and not by
checking for a trailing slash.....
understood.
But what do you expect from this? Skipping a directory just means not updating
meta data.
Currently, using --skip-old-files, I get a listing of directories and
non-directory
files without any indication of file type. It would be nice to have an
indication in
this listing of file types, or at least, which files are directories and
which are not,
so that I can then easily pick out non-directory files.
What I'm doing is extracting from a tar.xz archive, without overwriting
existing files,
then, examining which files where not extracted, then making a decision
about extracting
some or all of the pre-existing files.
Jörg