source: trunk/gli/src/org/greenstone/gatherer/util/Zipup.java@ 9181

Last change on this file since 9181 was 9181, checked in by mdewsnip, 19 years ago

Code for zipping up stuff on the server to send back to the applet.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: Matthew Whyte, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37
38package org.greenstone.gatherer.util;
39
40import java.io.File;
41
42/*
43 Class to zip up a given directory of a given Greenstone collection.
44
45 Arguments:
46 gsdlhome, the home of greensone, eg "/research/mgw5/gsdl/"
47 collecion, thename of the collection, eg "mgw5-test"
48 dir, the name of the directory to zip up, eg "archives"
49 [accept_expression], a regular expression of files to exclusively include in the archive
50 [reject_expression], a regular expression of files to exclude from the archive
51
52 @see org.greenstone.gatherer.util.Utility#zipup
53 */
54public class Zipup {
55
56 public static void main(String[] args) {
57
58
59 if (args.length < 3 || args.length > 8) {
60 System.err.println("Usage: Zipup gsdlhome collection directory [-accept accept_expression] [-reject reject_expression]");
61 return;
62 }
63
64 boolean metadata_only = false;
65 String gsdl_home = args[0];
66 String collection = args[1];
67 String directory = args[2];
68 String accept_expr = "";
69 String reject_expr = "";
70
71 for(int i=0; i < args.length; i++) {
72 if(args[i].compareTo("-accept") == 0) {
73 if(args.length >= i+1) {
74 accept_expr = args[++i];
75 }
76 else {
77 System.err.println("Usage: Zipup gsdlhome collection directory [-accept accept_expression] [-reject reject_expression]");
78 return;
79 }
80 }
81 else if(args[i].compareTo("-reject") == 0) {
82 if(args.length >= i+1) {
83 reject_expr = args[++i];
84 }
85 else {
86 System.err.println("Usage: Zipup gsdlhome collection directory [-accept accept_expression] [-reject reject_expression]");
87 return;
88 }
89 }
90 }
91
92 Utility.zipup(gsdl_home + "collect/", collection, directory, null, accept_expr, reject_expr);
93 }
94}
Note: See TracBrowser for help on using the repository browser.