![]() |
|
|
|||||||
![]() |
Java - Add an empty dir to a Zip file programmatically |
|
|
Thread Tools | Search this Thread |
|
|
#11 |
|
"Covington Bradshaw" <> wrote in message news > Ok I found out! > The trick is to postpend /. to the directory name, or programmatically as > follows > System.getProperty("file.separator")+"." > > > import java.util.zip.ZipEntry; > import java.util.zip.ZipOutputStream; > ... > try { ZipEntry dirEntry = new > ZipEntry(dirFile.getPath()+System.getProperty("fil e.separator")+"."); > zipOutputStream.putNextEntry(dirEntry); > } > catch (IOException e) {} > > This adds an empty file with name "." of zero size, which stands for the > directory iself! > But you say it is a file ! nos |
|
|
|
|
#12 |
|
Junior Member
Join Date: May 2007
Posts: 1
|
Nice solve but with one mistake. If u want to make "ONLY" empty directory just write
import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; ... try { ZipEntry dirEntry = new ZipEntry(dirFile.getPath()+System.getProperty("fil e.separator")); zipOutputStream.putNextEntry(dirEntry); } catch (IOException e) {} I dont understand why u make empty file "." Drax |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SONY DVD RW DW-G120A SOMETIMES FAILS...... | atlantic965 | DVD Video | 0 | 06-18-2006 10:36 PM |
| problems backing up dvds | Lawrence Traub | DVD Video | 11 | 09-27-2005 07:34 PM |
| Re: Ripping DVDs. Please answer the attached question. - Question.txt | Stan Brown | DVD Video | 19 | 02-09-2005 11:19 PM |
| Burn process failed - help! Log file posted for help troubleshooting | Michael Mason | DVD Video | 1 | 08-16-2004 09:24 PM |
| Pioneer A05 Problems | Bill Stock | DVD Video | 8 | 11-28-2003 05:03 AM |