Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8072979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:11:32+00:00 2026-06-05T14:11:32+00:00

A proprietary program that I’m working with zips up and extracts certain files without

  • 0

A proprietary program that I’m working with zips up and extracts certain files without changing the modified date of the files when unzipping. I’m also creating my own zip and extraction tool based off the source code in our program but when I’m unzipping the files the modified date of all zipped files is showing with the unzip time & date. Here’s the code for my extraction:

public static int unzipFiles(File zipFile, File extractDir) throws Exception 
{
        int totalFileCount = 0;
        String zipFilePath = zipFile.getPath();

        System.out.println("Zip File Path: " + zipFilePath);

        ZipFile zfile = new ZipFile(zipFile); 
        System.out.println("Size of ZipFile: "+zfile.size());

        Enumeration<? extends ZipEntry> entries = zfile.entries(); 

        while (entries.hasMoreElements()) 
        { 
          ZipEntry entry = entries.nextElement(); 
          System.out.println("ZipEntry File: " + entry.getName());
          File file = new File(extractDir, entry.getName()); 
          if (entry.isDirectory()) 
          { 
            System.out.println("Creating Directory");
            file.mkdirs(); 
          } 
          else 
          { 
            file.getParentFile().mkdirs(); 
            InputStream in = zfile.getInputStream(entry); 
            try 
            { 
              copy(in, file); 
            } 
            finally 
            {   
              in.close(); 
            } 
          } 
          totalFileCount++;
        }
        return totalFileCount; 
      } 

private static void copy(InputStream in, OutputStream out) throws IOException 

{

  byte[] buffer = new byte[1024]; 
  System.out.println("InputStream/OutputStram copy");
  while (true) 
  { 
    int readCount = in.read(buffer); 
    if (readCount < 0) 
    { 
      break; 
    } 
    out.write(buffer, 0, readCount); 
   } 
} 

I’m sure there is a better way to do this other than doing the inputstream/outputstream copy. I’m sure this is the culprit as doing an extraction with winRAR does not change the date with the files I zipped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:11:34+00:00Added an answer on June 5, 2026 at 2:11 pm

    Use ZipEntry.getTime to get the last-modified time and File.setLastModified to set it on the file after you are done copying it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We performed an upgrade of a proprietary program that formerly used Access and now
I'm working on a project that has a proprietary file format. The project has
I use a proprietary date format that looks like this: var TheUserDate = 3.11.2012.4.3;
I have a working python 2.7 program that calls a DLL. I am trying
I've got a proprietary program that I'm trying to use on a 64 bit
I have a proprietary command-line program that I want to call in a bash
I'm working on a third-party program that aggregates data from a bunch of different,
I have an old, third party, command line, proprietary program which I'm calling from
My company's proprietary software generates a log file that is much easier to use
I have text files containing structured data (it is a proprietary format and not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.