Results 1 to 4 of 4
  1. #1
    rach is offline Member
    Join Date
    Jul 2007
    Posts
    6
    Rep Power
    0

    Default URGENTTT...zip folders in java

    i have written a code whihc recursively zips the folders and subfolders in a directory but the directory structure in not retained in the .zip folder..i.e when i open it there are files but not folders(whereas in .rar this problem is not there).
    and also the code zips the folder passed in the command line argument but it is showing errors for some paths
    i.e;
    consider java and jack n jill are two folders.

    it works fine for

    java Zipjunu c:\java

    but it shows error for

    java Zipjunu c:\jack n jill

    it gives FileNotFoundException c:\jack

    please help..
    here is the code snippet for that :

    Java Code:
    throws IOException,FileNotFoundException
    {
    File file=new File(fileName);
    zos=new ZipOutputStream(new FileOutputStream(file+".zip"));
    
    System.out.println("file path:" +file.getAbsolutePath());
    
    recurseFiles(file);
    zos.close();
    please help!!

  2. #2
    rach is offline Member
    Join Date
    Jul 2007
    Posts
    6
    Rep Power
    0

    Default

    i found the problem..

    String fileName=args[0]

    so it was looking for only c:\jack

    i was using this...
    can someone tell me how to out all the args in a string so that i can use that as path name

  3. #3
    Bojevnik is offline Member
    Join Date
    Aug 2007
    Posts
    13
    Rep Power
    0

    Default

    args is an array, so if you want to get opther values args[1], args[2]......
    and you just mold them together the way you like.
    I HATE SMURFS!!!!!

  4. #4
    rach is offline Member
    Join Date
    Jul 2007
    Posts
    6
    Rep Power
    0

    Thumbs up

    oh okies...instead of arguments i used bufferedreader..

    /through with the problem :D :cool:

Similar Threads

  1. Replies: 20
    Last Post: 12-17-2007, 04:20 PM
  2. Replies: 2
    Last Post: 11-27-2007, 02:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •