Hey all,
In case this might be helpful to others...
#!/usr/bin/perl
# 2002/08/18 - [EMAIL PROTECTED]
#
# Convert a maven b4 repository to b5 layout. Only "well-named" files
# will be relocated.
#
# Usage:
# cd path/to/repository
# .../relocator -m *.jar
#
# If you need to leave the files in place also (e.g. - you have to
# support both b4 and b5) do:
# .../relocator -c *.jar
use File::Copy;
use File::Path;
use Getopt::Std;
my %opts = {};
getopts("cm",\%opts);
while(@ARGV) {
(my $jarfile = shift @ARGV) =~ m/^(.*)-([0-9].*).jar/;
my ($package,$version,$path) = ($1,$2,"$1/jars");
if( !$package || !$version ) {
print STDERR "Don't know what to do with $jarfile\n";
next;
}
if( ! -d $path && !mkpath($path,0) ) {
print STDERR "Failed to make path ($path)\n";
next;
}
if( $opts{c} ) {
print "Copying $jarfile to $path\n";
copy("$jarfile","$path/$jarfile");
}
elsif( $opts{m} ) {
print "Moving $jarfile to $path\n";
move("$jarfile","$path/$jarfile");
}
else {
print "$jarfile -> $path\n";
}
}
if( !$opts{c} && ! $opts{m} ) {
print STDERR "\n\nNow execute me again with -c to copy files or -m to
move them\n";
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>