Hey guys, how are you?
I am just looking for a method that could compress more than one file passed as argument in only one .zip, for exemple I have two files and one folder after compressing will be only one file named compressedallfile.zip. Got it?
Never having seen that exception I'm on uncertain ground here. Though I don't like your use of 'continue' there is nothing that stands out to me as being wrong. Points :-
1) You would do better to use File#listFiles() rather than File#list() since this would return you an array of files. It is usually better to work with File objects than String objects when dealing with files. Note that the return list can be 'null' so make sure you handle that.
2) Having never used it in this scenario I'm not sure what happens creating the entry name of f.getPath(). I always use f.getCanonicalPath() and strip off the first N characters when N is the length of the root.getCanonicalPath(). Example -
3) I seem to remember that the path separator in zip files is always '/' but I can't be sure.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Sir, I tried all day to fix this problem but I can't... My doubt is howto transform/do this following method that works compress a directory/folder
as well because currently only compress files... I know that I need recursivity but I don't get to do sorry... Look at below please:
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop