#296665 "p7zip should allow exclude lists with absolute paths"

Package:
p7zip
Source:
p7zip
Description:
7zr file archiver with high compression ratio
Submitter:
Adam Porter
Date:
2025-03-14 14:51:05 UTC
Severity:
wishlist
Tags:
#296665#5
Date:
2005-02-23 21:09:53 UTC
From:
To:
I'm trying to compress some backup data.  I've rsync'ed some directories
to another partition, /mnt/backup.  I want to compress
/mnt/backup/home/first with 7z so that I can burn it to a CD.  However,
I want to exclude some directories from the 7z file, because they are
huge (oggs and digicam photos), and I don't need to back them up to CD.
   I want to exclude these directories:

/mnt/backup/home/first/Music
/mnt/backup/home/first/Images/Pictures/Picasa
/mnt/backup/home/first/Images/Pictures/Photos/Picasa

So I created a file with a list of directories to exclude:

/mnt/backup/7z.home.exclude.list
====
Music/*
Images/Pictures/Picasa/*
Images/Pictures/Photos/Picasa/*
====

Then I ran this command:

# 7z a /mnt/backup/home/first.7z /mnt/backup/home/first/*
-x@/mnt/backup/7z.home.exclude.list

7z works, and it does not complain like it does if I specify an invalid
file list, but it does not exclude those directories.

So I tried using absolute paths in the exclude file list:

/mnt/backup/7z.home.exclude.list
====
/mnt/backup/home/first/Music/*
/mnt/backup/home/first/Images/Pictures/Picasa/*
/mnt/backup/home/first/Images/Pictures/Photos/Picasa/*
====

Then I ran the same command, but 7z still did not exclude those directories.

Finally I tried removing the "/*" at the end of each line:

/mnt/backup/7z.home.exclude.list
====
/mnt/backup/home/first/Music
/mnt/backup/home/first/Images/Pictures/Picasa
/mnt/backup/home/first/Images/Pictures/Photos/Picasa
====

Then I ran the same command, and it still will not exclude the directories.

I also tried removing the "/*" and using relative paths:

/mnt/backup/7z.home.exclude.list
====
Music
Images/Pictures/Picasa
Images/Pictures/Photos/Picasa
====

That, of course, didn't work either.

Is there any way to exclude directories from being included???  Am I
doing something wrong, or is this a bug?

#296665#10
Date:
2005-03-02 14:08:08 UTC
From:
To:
tag 296665 upstream
thanks

Concerning excluding directories, a similar bug has already been
reported at "upstream's upstream" (that's to say at 7-zip for Windows
itself = Igor Pavlov) here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1072327&group_id=14481&atid=114481

Upstream can't answer about this and he is waiting for this to be fixed
by Igor Pavlov.

Perhaps following
http://sourceforge.net/forum/forum.php?thread_id=1211890&forum_id=45798
trick would work.

7-Zip, as it is currently, is not intended for backup purpose, if not
used with tar.

#296665#23
Date:
2005-05-14 07:09:04 UTC
From:
To:
Just FYI, this still doesn't work with 4.18-1.  I checked the upstream
bug report, but no progress has been made on it.

#296665#28
Date:
2005-11-27 16:24:41 UTC
From:
To:
the syntax you gave to me in this bug report.

[0] http://adn.diwi.org/debian/p7zip/excluding-dirs.sh.txt
[1] http://adn.diwi.org/debian/p7zip/excluding-dirs.sh

Here[2] is the output.

[2] http://adn.diwi.org/debian/p7zip/excluding-dirs.sh.txt

Conclusion: one has to put the relative paths to the directories from
            the directory from where you are adding to archive.

May I close this report? I think I will add some information about this
in next upload's documentation.

#296665#33
Date:
2005-11-28 17:40:58 UTC
From:
To:
Mohammed Adnène Trojette wrote:

Thanks for following up.

I ran your script and checked the output, and now I understand what you
mean.  (Running version "4.29 beta", BTW.)  It seems to work in a fairly
logical manner now.  However, I did notice one thing that is still
confusing, and should at least be noted, IMO.  I used your script, but
changed the archive command to this:

$ 7z a directory.7z directory/* -x@exclude.list

That results in the exact same archive as your unmodified script.  The
confusing part is, it would seem to me that adding the "/*" should cause
not the directory itself to be added to the archive, but only the
contents of the directory; i.e. instead of the archive containing a
"directory/contents of directory" structure, it should only contain the
contents of "directory", with no parent directory.

I guess that's a separate issue, so I don't see any reason to not close
this bug.  (Finally!)  But I do think it should be mentioned in the man
page, at least, because it doesn't do what one would think it should do
(IMHO).

#296665#38
Date:
2005-11-28 17:44:37 UTC
From:
To:
Actually, though, the more I think about it, shouldn't you be able to
use absolute paths when you're excluding files and directories,
regardless of the working directory when you create the archive?
Shouldn't you be able to use absolute paths to exclude when you use
absolute paths to create the archive?  Doesn't tar let you do that?

#296665#43
Date:
2005-11-28 17:51:51 UTC
From:
To:
Ok, last reply this round, I promise.

I still don't think 7z does it right.  You can work around it by using
the method you discovered, but I don't think 7z does the "right thing."
 I did another version of the script like this:

$ 7z a /tmp/directory.7z /tmp/directory -x@exclude.list

The result?  Nothing ever got excluded.  Even when the exclude list was:

$ echo /tmp/directory/1 >> exclude.list
$ echo /tmp/directory/10 >> exclude.list

Surely that is not proper behavior.  I apologize for saying the bug was
ok to close earlier, but honestly, this just doesn't seem right.