Newsgroups: fj.questions.unix
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!wnoc-sfc-news!wnoc-kyo-news!aist-nara!odins-suita!ougw2!ccews7!newssinet!news.ipc.chiba-u!news.tj.chiba-u!asada
From: asada@ics.tj.chiba-u.ac.jp (Takuya Asada)
Subject: Re: no overwrite 'mv'
Message-ID: <DGL1y3.HIy@ics.tj.chiba-u.ac.jp>
Sender: usenet@ics.tj.chiba-u.ac.jp
Nntp-Posting-Host: icsj6.tj.chiba-u.ac.jp
Organization: Chiba-University
References: <45v2gb$bku@csdnews.sm.sony.co.jp>
Date: Tue, 17 Oct 1995 07:54:02 GMT
Lines: 29
Xref: galaxy.trc.rwcp.or.jp fj.questions.unix:4974
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.questions.unix&nb=4974&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

$B$"$5$@$J$N$G$9!#(B

$B:dK\$5$s(B>
> > mv -i $B$G!"$$$A$$$A(B n $B$rBG$D$N$,LLE]=-$$$s$G$9!#(B
> $B;d$NCN$k8B$j!"$3$l$,$&$^$/$$$/$N$O(B FreeBSD $B$N(B mv $B$@$1$G$9!#(B

$B<B$O;d$b0l=V(B "yes n | mv -i" $B$r9M$($?$N$G$9$,!";n$7$?$i%@%a$@$C$?(B
$B$N$G5$IU$$$?$N$G$7$?!#(B

$B$$$D$b$O%5%/$C$H(B

 % foreach f ($B%U%!%$%k(B)
 ? if (! -f $B0\F0@h(B/$a) mv $a $B0\F0@h(B/
 ? end

$B$_$?$$$K$7$F:Q$^$;$A$c$&$N$G$9$,!"$^$!%9%/%j%W%H$r=q$/$J$i!"(B

 #!/usr/local/bin/perl
 $d = pop(@ARGV);
 for (@ARGV) {
        push(@f, $_) unless (-f $d."/".$_);
 }
 system "mv @f $d";

$B$J$s$F%$%+%,$G$7$g$&!J%a%s%I%&$J$N$G(B perl $B$r;H$C$F$7$^$C$?(B ^^;$B!K!#(B

$B$"$5$@(B $B$?$/$d(B


