# predeclare subroutines so subs; can be called before being declared
# and without ()
####
# one line to make sure there is one and only one "/"
$target_dir=~s<^/*>>;
##
##
#get first character in target_dir
my $first_char = substr( $target_dir, 0, 1 );
writeLog( "debug - first character in target_dir $target_dir = $first
+_char" ) if ( $debug );
if ( $first_char ne '/' ) {
writeLog( "debug - adding / to beginning of target_dir $target_dir"
+) if ( $debug );
#add "/" to beginning of filepath
$target_dir = '/'.$target_dir;
}
else {
writeLog( "debug - / already exists at beginning. target_dir remains
+ $target_dir" ) if ( $debug );
}
#beginning has already been checked for "/" so check for addl
# "/"s at position 1 ( ///IN/CF/ becomes /IN/CF/ )
#if position 1 is "/" chop it out and continue until position
#1 is not a "/"
writeLog( "debug - checking for multiple '/'s at beginning of target
+dir $target_dir" ) if ( $debug );
my $second_char = substr( $target_dir, 1, 1);
writeLog( "debug - initial second character in target_dir $target_dir
+ = $second_char" ) if ( $debug );
while ( substr( $target_dir, 1, 1) eq '/' ) {
writeLog( "debug - removing / from second character in target_dir $t
+arget_dir" ) if ( $debug );
chop( substr( $target_dir, 1, 1 ) );
writeLog( "debug - target_dir = $target_dir" ) if ( $debug );
}
##
##
#verify that file exists
checkFileExists() if ( ! $interactive );