home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-06-02 | 2.2 KB | 104 lines |
- '
- 'File Copier - By Paul Hickman 10/4/1993
- '
- Screen Open 0,640,60,2,Hires : Palette 0,$ADF : Curs Off : Cls
- S$=Fsel$("","","Select Source File")
- If S$<>""
- Repeat
- D$=Fsel$("","","Select Dest Dir (Set Dir)","Or Filename to Rename To")
- If D$=""
- If Instr(S$,"/")=0
- D$=Dir$+Mid$(S$,Instr(S$,":")+1)
- Else
- A$=S$
- While Instr(A$,"/")>0
- A$=Mid$(A$,Instr(A$,"/")+1)
- Wend
- D$=Dir$+A$
- End If
- End If
- Until S$<>D$
- If Not Exist(S$)
- Repeat
- Cls
- Centre "Cannot Find File:" : Print
- Centre S$ : Print
- MOUSEYN
- Until Exist(S$)
- End If
- On Error Proc ERRHANDLE
- Repeat
- ERRFREE=True : STAGE=1
- Open In 1,S$ : L=Lof(1) : Close 1
- Until ERRFREE
- If L=0
- Centre "Fatal Error: Length Of Source File is 0"
- End
- End If
- '
- STAGE=2
- '
- Repeat
- ERRFREE=True
- Reserve As Work 15,L
- Until ERRFREE=True
- '
- STAGE=3
- '
- Repeat
- ERRFREE=True
- Bload S$,Start(15)
- Until ERRFREE=True
- '
- STAGE=4
- '
- If Exist(D$)
- Cls : Centre "Warning - Desination File Already Exists:" : Print
- Centre D$ : Print : Print
- Centre "Left Mouse: Overwrite Right Mouse : Abort Copy"
- Repeat : Until Mouse Key=0
- Repeat : Until Mouse Key>0
- If Mouse Key=2
- Erase 15 : End
- End If
- End If
- '
- STAGE=5
- '
- Bsave D$,Start(15) To Start(15)+Length(15)
- Erase 15
- End If
- '
- Procedure ERRHANDLE
- Shared STAGE,ERRFREE,S$,D$
- If STAGE=1
- Cls : Centre "Error In Finding Length Of Source File:" : Print
- Centre S$ : Print
- MOUSEYN
- End If
- If STAGE=2
- Cls : Centre "Cannot Reserve Enough Memory To Hold Copy Of Source File:" : Print
- Centre S$ : Print
- MOUSEYN
- End If
- If STAGE=3
- Cls : Centre "Error In Reading Source File:" : Print
- Centre S$ : Print
- MOUSEYN
- End If
- If STAGE=5
- Cls : Centre "Error In Writing Destination File:" : Print
- Centre D$ : Print
- MOUSEYN
- End If
- Resume
- End Proc
- Procedure MOUSEYN
- Print
- Centre "Left Mouse: Try Again Right Mouse: Abort Copy" : Print
- Repeat : Until Mouse Key=0
- Repeat : Until Mouse Key>0
- If Mouse Key=2
- End
- End If
- End Proc