<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<br>Hi y'all
<p>Because I had to import some stuff as well, I created a Perl script
that <i>generates</i> a manifest.xml file for you!
<p>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.
<br>
<ul>
<li>
<tt>cd <wherever></tt></li>
<li>
<tt>manigen.pl <mydir> > manifest.xml</tt></li>
<li>
<tt>zip <myarchive.zip> manifest.xml <mydir></tt></li>
<li>
<tt>cp <myarchive.zip> <my_exportdir></tt></li>
</ul>
<p><br>This way you can easily import whole file trees!
<br>Jeroen
<p>Perl source of manigen.pl:
<br><i>Note: you can assign a user, group and access mask with the variables
<tt>$user</tt>,<tt>$group</tt>, and <tt>$access</tt> ;-).</i>
<p>--- begin ---
<br><tt>#!/usr/bin/perl</tt>
<br><tt> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'</tt>
<br><tt> if $running_under_some_shell;</tt><tt></tt>
<p><tt>require "find.pl";</tt><tt></tt>
<p><tt>print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";</tt>
<br><tt>print "<export>\n";</tt>
<br><tt>print "\t<!-- Creator: manigen.pl $ARGV[0] -->\n";</tt>
<br><tt>print "\t<!-- Createdate: $^T -->\n";</tt>
<br><tt>print "\t<files>\n";</tt><tt></tt>
<p><tt># Traverse desired filesystems</tt>
<br><tt>&find($ARGV[0]);</tt><tt></tt>
<p><tt>print "\t</files>\n";</tt>
<br><tt>print "</export>\n";</tt><tt></tt>
<p><tt>exit;</tt><tt></tt>
<p><tt>sub wanted {</tt>
<br><tt> $user="Admin";</tt>
<br><tt> $group="Users";</tt>
<br><tt> $access=79;</tt>
<br><tt> if ( $name ne "." )
{</tt>
<br><tt>
if (-d $_ ) {</tt>
<br><tt>
print "\t\t<file>\n";</tt>
<br><tt>
print "\t\t\t<destination>$name</destination>\n";</tt>
<br><tt>
print "\t\t\t<type>folder</type>\n";</tt>
<br><tt>
print "\t\t\t<user>$user</user>\n";</tt>
<br><tt>
print "\t\t\t<group>$group</group>\n";</tt>
<br><tt>
print "\t\t\t<access>$access</access>\n";</tt>
<br><tt>
print "\t\t\t<properties/>\n";</tt>
<br><tt>
print "\t\t</file>\n";</tt>
<br><tt>
} elsif (-f $_ ) {</tt>
<br><tt>
if (/\.(gif|jpg|png)$/i) {</tt>
<br><tt>
$type="image";</tt>
<br><tt>
} else {</tt>
<br><tt>
$type="plain";</tt>
<br><tt>
}</tt>
<br><tt>
print "\t\t<file>\n";</tt>
<br><tt>
print "\t\t\t<source>$name</source>\n";</tt>
<br><tt>
print "\t\t\t<destination>$name</destination>\n";</tt>
<br><tt>
print "\t\t\t<type>$type</type>\n";</tt>
<br><tt>
print "\t\t\t<user>$user</user>\n";</tt>
<br><tt>
print "\t\t\t<group>$group</group>\n";</tt>
<br><tt>
print "\t\t\t<access>$access</access>\n";</tt>
<br><tt>
print "\t\t\t<properties/>\n";</tt>
<br><tt>
print "\t\t</file>\n";</tt>
<br><tt>
}</tt>
<br><tt> }</tt>
<br><tt>}</tt>
<br>--- end ---
<br> </html>