From 6777ec12f6cb48e854e677115ce28d77a2dede55 Mon Sep 17 00:00:00 2001 From: lancel Date: Wed, 17 Oct 2001 05:21:52 +0000 Subject: [PATCH] Added error checking against multiple files to one file. Eliminated depreciated special variable. $ARGV($#ARGV) to $ARGV(-1) --- contrib/shell_utils/apple_mv | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/shell_utils/apple_mv b/contrib/shell_utils/apple_mv index 956924ab..ae5c5ded 100644 --- a/contrib/shell_utils/apple_mv +++ b/contrib/shell_utils/apple_mv @@ -1,9 +1,13 @@ #! /usr/bin/perl # -# $Header: /home/ralph/netatalk/rsync/netatalk/contrib/shell_utils/Attic/apple_mv,v 1.2 2000-08-09 14:12:06 rufustfirefly Exp $ +# $Header: /home/ralph/netatalk/rsync/netatalk/contrib/shell_utils/Attic/apple_mv,v 1.3 2001-10-17 05:21:52 lancel Exp $ # # $Log: apple_mv,v $ -# Revision 1.2 2000-08-09 14:12:06 rufustfirefly +# Revision 1.3 2001-10-17 05:21:52 lancel +# Added error checking against multiple files to one file. Eliminated +# depreciated special variable. $ARGV($#ARGV) to $ARGV(-1) +# +# Revision 1.2 2000/08/09 14:12:06 rufustfirefly # /usr/local/bin/perl -> /usr/bin/perl and portability fixes # # Revision 1.1 2000/08/09 14:08:06 rufustfirefly @@ -27,7 +31,7 @@ Do an apple move, moving the resource fork as well USAGE @from = @ARGV; pop(@from); -$to = $ARGV[$#ARGV]; +$to = $ARGV[-1]; if (-f $to && @from > 1) { die $USAGE; } @@ -36,6 +40,11 @@ foreach $from (@from) { print STDERR "file $from does not exist\n"; die $USAGE; } + + if (!-d $to && @from >1) { + print STDERR "directory $to does not exist\nCan't move multiple files into one file.\n"; + die $USAGE; + } $from = escape_bad_chars($from); $to = escape_bad_chars($to); -- 2.39.2