• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Programatically creating directory in zip file

 
Logeswaran Radhakrishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a two strings A and B and a document ,i want to create a folder Structure A->B->document in the ZIP file programatically.
Help me out how to create a folder in the zip file with the given string .



Thanks and Regards
Logeswaran
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add the directory in the name in the ZipEntry: directory/file.txt
 
Logeswaran Radhakrishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob

Thanks for the immdiate reply.But that doesnt help me out.
Let me brief my scenario.

Consider that my file resides in C:\\file.doc.I ll fetch that file name programatically by using file.list().

After this the user will give two strings as input .Only Strings not the directories .

I have to make two directories in the zip file for the given two strings inside which i have to add my file( C:\\file.doc) .




 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search in this forum for my posts regarding zipping. I've posted (pseudo)code for recursively zipping entire directories before.
 
Logeswaran Radhakrishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,
I have gone through your postings.Using it what i have done is i have created a directory structure for the given strings by
.


Inside the dir2 folder i have copied some files.When i tried to zip the dir2 it shows the following error.



I think i have to set the folder access permissions programatically.Is that right?

Help me out to solve the issue.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't mix \\ and / inside file names.
 
Logeswaran Radhakrishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob the issue is resolved..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic