--- foxridge-archiver/MPIWGStor.pm 2005/08/23 15:01:08 1.4 +++ foxridge-archiver/MPIWGStor.pm 2007/03/06 17:41:25 1.8 @@ -12,7 +12,7 @@ use vars qw(@ISA @EXPORT $VERSION $file_perm); use Exporter; -$VERSION = 0.6.1; # ROC 8.8.2005 +$VERSION = 0.6.3; # ROC 6.3.2007 @ISA = qw(Exporter); @@ -27,13 +27,24 @@ $debug = 0; # junk files %junk_files = ( - '.HSResource' => '.HSResource', - '.HSancillary' => '.HSancillary', - '.HSicon' => '.HSicon', - 'Network Trash Folder' => 'Network Trash Folder', - 'TheVolumeSettingsFolder' => 'TheVolumeSettingsFolder', - '.DS_Store' => '.DS_Store' - ); + # netatalk stuff + '.AppleDB' => '.AppleDB', + '.AppleDesktop' => '.AppleDesktop', + '.AppleDouble' => '.AppleDouble', + '.FBCIndex' => '.FBCIndex', + '.FBCLockFolder' => '.FBCLockFolder', + ':2eTemporaryItems' => ':2eTemporaryItems', + ':2eDS_Store' => ':2eDS_Store', + # standard appleshare stuff + '.DS_Store' => '.DS_Store', + '.TemporaryItems' => '.TemporaryItems', + 'Network Trash Folder' => 'Network Trash Folder', + 'TheVolumeSettingsFolder' => 'TheVolumeSettingsFolder', + # old appleshare software turds + '.HSResource' => '.HSResource', + '.HSancillary' => '.HSancillary', + '.HSicon' => '.HSicon' + ); # filenames to not delete (but archive) %index_files = ( @@ -140,25 +151,35 @@ sub ymd_date { # file name (the last path element) and path # sub split_file_path { - my ($fn) = @_; + my ($fn, $nodot) = @_; if ($fn =~ /^(.*)\/([^\/]+)$/) { return ($2, $1); + } + # only file name + if ($nodot) { + return ($fn, ''); + } else { + return ($fn, '.'); } - return ($fn, '.'); # only file name } # -# $name = sstrip($name) +# $name = sstrip($name, $slash) # # strips leading and trailing whitespace from $name +# replaces double slashes with single ones with $slash. # sub sstrip { - my ($name) = @_; + my ($name, $slash) = @_; - if ($name =~ /\s*(.*)\s*/) { - return $1; + if ($name =~ /^\s*(.*?)\s*$/) { + $name = $1; + } + if ($slash) { + # trim multiple slashes + $name =~ s/\/+/\//g; } return $name; }