Results 1 to 4 of 4
Thread: URGENTTT...zip folders in java
- 08-13-2007, 08:45 AM #1
Member
- Join Date
- Jul 2007
- Posts
- 6
- Rep Power
- 0
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 :
please help!!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();
- 08-13-2007, 09:04 AM #2
Member
- Join Date
- Jul 2007
- Posts
- 6
- Rep Power
- 0
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
- 08-13-2007, 03:54 PM #3
Member
- Join Date
- Aug 2007
- Posts
- 13
- Rep Power
- 0
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!!!!!
- 08-13-2007, 03:55 PM #4
Member
- Join Date
- Jul 2007
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
can java.io.File create a list of all files and folders.
By MattStone in forum New To JavaReplies: 20Last Post: 12-17-2007, 03:20 PM -
How do you recursively traverse through file folders ?
By nimraj in forum New To JavaReplies: 2Last Post: 11-27-2007, 01:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks