copying files from jar file to a filesystem

C

craftereric

I have a jar file that contains directories and files. I need to copy
those directories and files to specified locations on a UNIX and
Windows file system. So directory A in the jar will be copied to C:/
Temp on Windows and /tmp in Unix. Is there any sample code that will
get me started? I guess I should use some sort of config file to
specify the source and destination directories.

The jar file has a structure like

A/
A/file1.txt
A/file2.txt

B/
B/file3.txt
B/file3.txt
 
C

craftereric

look at the class com.mindprod.replicator.FetchZips

It downloads zips and unpacks them.

Source is available athttp://mindprod.com/products1.html#REPLICATOR

Thanks for the reply. I looked at FetchZips but I don't think it will
meet my needs. I could package my directories/files in a zip instead
of a jar but I need to be able to copy certain directories to one
location and other files to another location based on the file/
directory name.

Are there other things I can try?
 
C

craftereric

Thanks for the reply. I looked at FetchZips but I don't think it will
meet my needs. I could package my directories/files in a zip instead
of a jar but I need to be able to copy certain directories to one
location and other files to another location based on the file/
directory name.

Are there other things I can try?

To expand on what I need the code to do:
For each directory or file in the archive, I need to process it. For
example, the file B/file3.txt would need to be copied to /var/tmp/
file.txt on a Unix machine and C:\Temp\LocalDir on a windows machine.
The entire directory A would need to be copied to /etc/ on Unix and C:
\Program Files\MyDir on Windows
 
H

Hunter Gratzner

Thanks for the reply. I looked at FetchZips but I don't think it will
meet my needs. I could package my directories/files in a zip instead
of a jar

A jar is a zip.
but I need to be able to copy certain directories to one
location and other files to another location based on the file/
directory name.

Write the code to do it. It is trivial.
Are there other things I can try?

Read the API documentation.
 
R

Roedy Green

Thanks for the reply. I looked at FetchZips but I don't think it will
meet my needs. I could package my directories/files in a zip instead
of a jar but I need to be able to copy certain directories to one
location and other files to another location based on the file/
directory name.

Are there other things I can try?

I did not intend for you to use FetchZips unmodified. It was to show
you how to use the low-level zip manipulating tools.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top