-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Using FilesFromDisk() for compressing files to root of archive #331
Comments
Thanks for the request. Just to be sure I understand, can you provide a sample directory tree and the expected names in the archives? Basically the expected inputs and outputs. |
Example. I have folder:
And I wanna put all files to root of archive folder.zip with structure:
I tried like this:
|
@nicola-spb Perfect, thanks. I'm headed out in a moment for lunch, but can you tell me real quick what the result is when you do this variant (which I know you already tried): files, err := archiver.FilesFromDisk(nil, map[string]string{
"/path/on/disk/folder": "",
}) Because I think that should do what you're looking for... 🤔 I'd test it myself but I'll read your reply during lunch. |
@mholt I tried now. It make archive with structure:
|
@mholt And when I tried before I had strange result with this: It created archive with folder "." and have this structure:
Maybe it's bug... |
Now permit suffixing root on disk with separator to enumerate only its contents and not to create that actual file in archive. And attempt improving Windows compatibility.
@nicola-spb You really like breaking my code huh 😆 I opened #332 which should hopefully address your needs, if you suffix the file on disk with a trailing slash: files, err := archiver.FilesFromDisk(nil, map[string]string{
"/path/on/disk/folder/": "",
}) I have not yet looked into the "." input, that will probably have to happen another day. |
Hi, when I use create archive and use archiver.FilesFromDisk with ZIP format then I have broken archive. I cannot extract archive (in Ubuntu) and when I open archive in windows I see folder sourceDir (root) but archive should not have it's folder.
|
@nicola-spb Can you please open a new issue and provide enough information for me to reproduce the behavior as simply as possible? (Directory structure, a full |
What would you like to have changed?
I wanna use archiver.FilesFromDisk for archiving files from folder to root of archive like this:
Why is this feature a useful, necessary, and/or important addition to this project?
I think it is useful feature.
What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?
Without this feature I need to write:
Please link to any relevant issues, pull requests, or other discussions.
The text was updated successfully, but these errors were encountered: