Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help structured archive #216

Closed
BorisKozo opened this issue Mar 8, 2020 · 1 comment
Closed

Help structured archive #216

BorisKozo opened this issue Mar 8, 2020 · 1 comment
Labels

Comments

@BorisKozo
Copy link

Hi,

I spent ~2 hours on this and can't figure it out. I have 3 files:

C:\MyDir\a.txt
C:\MyDir\InnerDir\b.txt
C:\MyDir\InnerDir\c.txt

I want the archive to contain only a.txt and b.txt with their structure like this:

a.txt
InnerDir\b.txt

This is my code:

	arch := archiver.Zip{
		CompressionLevel:       flate.DefaultCompression,
		MkdirAll:               true,
		SelectiveCompression:   true,
		ContinueOnError:        false,
		OverwriteExisting:      false,
		ImplicitTopLevelFolder: true,
	}
	arch.Archive([]string{<WHAT DO I PUT HERE????>}, "C:\\temp\\test.zip")

It either puts all the files in the root of the archive or doesn't let me filter out c.txt.

Any help would be appreciated.

@mholt
Copy link
Owner

mholt commented Jan 2, 2022

Hi, sorry I never replied to this. I was busy writing Caddy 2 at the time.

I've completely rewritten this package in #302, which has new APIs that do exactly what you want: to be able to specify a custom structure for the archives and their mappings to the paths on disk. You can explicitly list each and every file, or add a whole directory. If you still need this, give it a try and let me know your thoughts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants