AW: [opencms-dev] FYI: importing files is easy with this script

Simon Wilks simon.wilks at silion.ch
Mon Jan 15 15:25:46 CET 2001


Hi Jerome,

A question: Can I use this to import an exported project from one OpenCms
system into another? I have tried but keep getting an exception from
OpenCms: "NO MESSAGE....NullPointerException" at
com.opencms.file.CmsImport.getXmlConfigFile

Any idea what I am doing wrong???

Thanks


Simon Wilks
software engineer
simon.wilks at silion.ch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
silion (switzerland) ag    software engineering
spinnereistrasse 8              9008 st. gallen
tel 0878 80 90 60             fax 0878 80 90 30
info at silion.ch                    www.silion.ch

a member of the Penta Group   www.pentagroup.ch

-----Ursprungliche Nachricht-----
Von: owner-opencms-dev at www.opencms.com
[mailto:owner-opencms-dev at www.opencms.com]Im Auftrag von Jeroen Habets
Gesendet: Montag, 15. Januar 2001 10:40
An: OpenCMS Developers list
Betreff: [opencms-dev] FYI: importing files is easy with this script



Hi y'all
Because I had to import some stuff as well, I created a Perl script that
generates a manifest.xml file for you!
go to directory that contains the directory with file tree you want to
import (in example mydir). Run manigen.pl <mydir> and zip the file tree and
the output of manigen.pl. The resulting archive can be imported into opencms
after it has been copied to the export directory of opencms.

cd <wherever>
manigen.pl <mydir>  >  manifest.xml
zip <myarchive.zip> manifest.xml <mydir>
cp <myarchive.zip> <my_exportdir>

This way you can easily import whole file trees!
Jeroen
Perl source of manigen.pl:
Note: you can assign a user, group and access mask with the variables
$user,$group, and $access ;-).
--- begin ---
#!/usr/bin/perl
    eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
        if $running_under_some_shell;
require "find.pl";
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
print "<export>\n";
print "\t<!-- Creator: manigen.pl $ARGV[0] -->\n";
print "\t<!-- Createdate: $^T -->\n";
print "\t<files>\n";
# Traverse desired filesystems
&find($ARGV[0]);
print "\t</files>\n";
print "</export>\n";
exit;
sub wanted {
        $user="Admin";
        $group="Users";
        $access=79;
        if ( $name ne "." ) {
                if (-d $_ ) {
                        print "\t\t<file>\n";
                        print "\t\t\t<destination>$name</destination>\n";
                        print "\t\t\t<type>folder</type>\n";
                        print "\t\t\t<user>$user</user>\n";
                        print "\t\t\t<group>$group</group>\n";
                        print "\t\t\t<access>$access</access>\n";
                        print "\t\t\t<properties/>\n";
                        print "\t\t</file>\n";
                } elsif (-f $_ ) {
                        if (/\.(gif|jpg|png)$/i) {
                                $type="image";
                        } else {
                                $type="plain";
                        }
                        print "\t\t<file>\n";
                        print "\t\t\t<source>$name</source>\n";
                        print "\t\t\t<destination>$name</destination>\n";
                        print "\t\t\t<type>$type</type>\n";
                        print "\t\t\t<user>$user</user>\n";
                        print "\t\t\t<group>$group</group>\n";
                        print "\t\t\t<access>$access</access>\n";
                        print "\t\t\t<properties/>\n";
                        print "\t\t</file>\n";
                }
        }
}
--- end ---





More information about the opencms-dev mailing list