-
Notifications
You must be signed in to change notification settings - Fork 15
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
Archiver modifies the last modified date of the folder to archive #7
Comments
Hey @oO0XX0Oo Unfortunately I'm not going to have a chance to look at this in detail probably for a week or so. However, I think I know what the issue is: For concurrent archiving, where multiple files are compressed at the same time, a staging directory is used. This staging directory is by default the directory to be archived. You can change the staging directory's location by passing the option: For changing the staging directory, you could do something like this: tmp, err := ioutil.TempDir("", "fastzip")
if err != nil {
return err
}
defer os.RemoveAll(tmp) // delete tmp directory after archiving complete
a, err := fastzip.NewArchiver(w, "~/fastzip-archiving", fastzip.WithStageDirectory(tmp))
... This will then use the operating system's default directory for temporary files. This isn't the default to avoid cross-filesystem problems. However, when this decision was made, I didn't foresee this directory modification date issue. I'll think on this further. At the very least, the documentation should make it clear that by default, the directory to be archived is used to stage files in (and then they're cleaned up). |
Hi @saracen Thanks for the quick answer! Additionally, thanks a lot for the example how to set up the temp folder and providing the necessary option to Archiver! Take your time if you really want to look deeper into this 'issue', it isn't urgent (any more) :) Merry Christmas! |
Unfortunately, a somehow related issue... This is only valid for the Windows operating systems! When Archiver stores the file dates from the files/folders inside the source path it sets the last modified time (sometimes it's called "birth time") to time.Now() instead of using the existing time. The same goes for Extractor. When it extracts an archive, the last modified date is set to time.Now() as well... Can you consider importing the times library: https://github.com/djherbis/times Thanks a lot, |
Hi,
I'm on MS Windows and when I use your "Archiver example" from the readme.me, the last modified date of the folder to archive is changed to now().
Instead of
~/fastzip-archiving
I'm using
R:/tst_zip/zip me"
which contains about 2000 files and 300 foldersIs there a way to avoid this behavior? I know that the last modified date is not know on linux but it is on Windows and it shouldn't be reset only because the folder gets zipped...
The text was updated successfully, but these errors were encountered: