home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 3
/
FREEWARE.BIN
/
oh_fm
/
townsfos
/
copy.bas
next >
Wrap
BASIC Source File
|
1980-01-02
|
2KB
|
73 lines
10000 '
10010 ' Copy : Copy a File
10020 '
10030 ' Filename "COPY.BAS"
10040 '
10050 ' Last Update 1989. 5.20 Version 1.01
10060 '
10070 '
10080 DEFINT A-Z
10090 OFLG=0
10100 SFL$="" : DFL$=""
10110 '
10120 IF ARGC>1 THEN *PARA
10130 PRINT : PRINT "***** Copy : Copy a File : Ver.1.01 *****"
10140 PRINT
10150 LINE INPUT " Souece Filename ? ",SFL$:IF SFL$="" THEN *END_EXIT
10160 LINE INPUT " Destination Filename ? ",DFL$:IF DFL$="" THEN *END_EXIT
10170 GOTO *MAIN
10180 '
10190 *PARA
10200 FOR I=1 TO ARGC-1 : A$=ARGV$(I)
10210 IF A$="?" THEN *HELP
10220 IF A$="-o" OR A$="-O" THEN OFLG=-1 : GOTO *PA_2
10230 IF SFL$="" THEN SFL$=A$:GOTO *PA_2
10240 IF DFL$="" THEN DFL$=A$:GOTO *PA_2
10250 GOTO *PARA_ERR
10260 *PA_2:NEXT
10270 GOTO *MAIN
10280 '
10290 *HELP
10300 S_A$="\n***** Help Message for Copy *****\n\n":GOSUB *S_PUTS_E
10310 S_A$=" Copy : Copy a File\n":GOSUB *S_PUTS_E
10320 S_A$=" Usage : Copy <Source> <Destination> [-o]\n":GOSUB *S_PUTS_E
10330 S_A$=" -o Over Write\n":GOSUB *S_PUTS_E
10340 GOTO *END_EXIT
10350 '
10360 *PARA_ERR
10370 S_A$="@ Parameter Error !\n":GOSUB *S_PUTS_E
10380 '
10390 *END_EXIT
10400 IF ARGC=0 THEN END
10410 RETURN *S_T_RETURN
10420 '
10430 ' COPY MAIN
10440 '
10450 *MAIN
10460 P=INSTR(SFL$,":"):IF P>0 THEN SFL2$=LEFT$(SFL$,P)+"(1)"+MID$(SFL$,P+1) ELSE SFL2$="(1)"+SFL$
10470 P=INSTR(DFL$,":"):IF P>0 THEN DFL2$=LEFT$(DFL$,P)+"(1)"+MID$(DFL$,P+1) ELSE DFL2$="(1)"+DFL$
10480 '
10490 *RTY
10500 OPEN "I",#1,SFL$ : CLOSE #1 : OPEN "R",#1,SFL2$ : FIELD #1,1 AS D1$
10510 ON ERROR GOTO *COPY_ERROR
10520 OPEN "O",#2,DFL$ : CLOSE #2 : OPEN "R",#2,DFL2$ : FIELD #2,1 AS D2$
10530 S&=LOF(1) : IF S&=0 THEN *LOOP_END
10540 FOR I&=1 TO S&
10550 GET #1
10560 LSET D2$=D1$
10570 PUT #2
10580 NEXT
10590 CLOSE
10600 GOTO *END_EXIT
10610 '
10620 *COPY_ERROR
10630 IF ERR<>64 THEN *E_2
10640 IF OFLG THEN *E_3
10650 *E_1:PRINT "@ File Alreay Exist ! : Over Write (Y/N) ";
10660 INPUT A$ : IF A$="" OR A$="n" OR A$="N" THEN *END_EXIT
10670 IF A$<>"y" AND A$<>"Y" THEN *E_1
10680 *E_3:CLOSE : KILL DFL$ : RESUME *RTY
10690 *E_2
10700 S_ERR=ERR
10710 RESUME *END_EXIT