my $argCount = scalar @ARGV;
 if (-d $ARGV[$argCount-1]) {
        $dstDir = $ARGV[$argCount-1];
+       # remove any trailing slash
+       $dstDir =~ s/\/$//;
        @srcArgs = @ARGV[0..$argCount-2];
        
        foreach $src (@srcArgs) {
 
 my (@allfiles,@srcfiles,@dstfiles);
 my $safesrc;
-my %overwritten;
+my (%overwritten, %srcForDst);
 
 $/ = "\0";
 open(F,"-|","git-ls-files","-z")
        }
     }
 
+    if ($bad eq "") {
+       if (defined $srcForDst{$dst}) {
+           $bad = "can not move '$src' to '$dst'; already target of ";
+           $bad .= "'".$srcForDst{$dst}."'";
+       }
+       else {
+           $srcForDst{$dst} = $src;
+       }
+    }
+
     if ($bad ne "") {
        if ($opt_k) {
            print "Warning: $bad; skipping\n";