Compress a folder to .zip on scala - scala

Please help me as much as possible to compress the entire folder with the contents in .zip or .gz on scala?
example
Path: C:\Users\Documents\temp (temp folder with contents)
after the path: C:\Users\Documents\temp.zip(.gz) or Path: C:\Users\Documents\temp\temp.zip(.gz)

I've implemented this kind of thing and I'm satisfied with Apache Compress. Their examples helped enough to implement combination of tar and gzip. After you've tried to implement it with their examples you can come back to SO for further questions.

Checkout : https://github.com/zeroturnaround/zt-zip
Pack a complete folder :
ZipUtil.pack(new File("C:\\somewhere\\folder"), new File("C:\\somewhere\\folder.zip"))
and there is unpack.

Related

How to zip a list of files of the same type using jar command

I have a folder on my computer at the following path:
/path/to/folder/
This folder contains a subfolder and many cvs files
folder/subfolder
folder/1.cvs
folder/2.cvs
...
folder/n.cvs
Now, I would like to be able to zip all the .cvs files into one .zip file using the jar command (long story...)
The best I could come up with is:
jar -cvfM output.zip -C /path/to/folder .
This works, but inside output.zip I also see the subfolder, is there any way to avoid it? I tried using the * wildcard like this:
jar -cvfM output.zip -C /path/to/folder *.cvs
But it doesn't work.
Is it possible?
Thanks in advance

script to auto move a folder with movie file

I have a download folder that is the destination for all torrent download files. I want a script which monitors that folder and then automatically only copy, moves the complete folder containing the movie file (mkv,avi,mp4...etc) and ignores everything else in the download folder. Is it possible
Thanks and Regards
Sammy
Which scripting language would you like to use? What OS are you on? It is quite possible, and if you chose Python as your scripting language, you would be able to find many useful scripts that do what you want.

how to reduce GWT war file size

i am using ExtGWT. my application has 5 modules. in war folder all five modules will be compiled and placed. but in every module resources folder is common. my intention is keeping resources folder common. so that the generated war size can be decreased. plz suggest me.
Thanks,
David
Perhaps not exactly, what you are asking for, but I guess, you don't want to upload everytime everything since the amount of data is quite large.
I do it this way:
- DON't create a war-file.
- simply use rsync to incrementally deploy the contents of the war-directory of your GWT-project like this:
rsync -avc --compress --progress --delete --rsh='ssh' --cvs-exclude
./war
root#serverip:/usr/share/tomcat7/webapps/ROOT/
So, only newer files gets uploaded to the server and remaining old files which are not used anymore gets deleted from the server.
Hoped this helped you.

How to move a file in to zip uncompressed, with zip cmd tool

I'm try to determine how to use the zip cmd line tool to move a file (uncompressed) in to a zip of compressed files (ie I want a zip in the end with all files but one compressed, b/c the one file is another compressed file).
Anyone know how to do this?
It looks like you could use -n option to just store the files with defined extensions together with -g option to append the file to archive.
I didn't test it, but something like this should do the trick:
zip -gn .foo archive.zip myAddedFile.foo
Although documentation states that, by default, zip does not compress files with extensions in the list .Z:.zip:.zoo:.arc:.lzh:.arj, so if you are adding a file with one of those extensions you should be fine.
Documentation to the command is here
-m is what I wanted, moves the file(s) into a zip.

How to use libz.dylib to unzip zip file?

in my program i have to unzip downloaded file ... i read libz.dylib is used for that but i didn't find any documentation or examples how to do that..?
any one know this...
Thanks in advance....
I'm not exactly answering your question, but you could use ZipKit. It is an Obj-C framework for using zip files.