Category : BASIC Source Code
Archive   : PBC30B.ZIP
Filename : FILECOPY.BAS

 
Output of file : FILECOPY.BAS contained in archive : PBC30B.ZIP
' +----------------------------------------------------------------------+
' | |
' | PBClone Copyright (c) 1990-1994 Thomas G. Hanlin III |
' | |
' +----------------------------------------------------------------------+

DECLARE FUNCTION ForceMatch$(Pattern$, SourceFile$)
DECLARE FUNCTION GetNameFx$ (Buffer$)
DECLARE FUNCTION GetSizeFx& (Buffer$)
DECLARE SUB CopyFile (FromFile$, ToFile$, ErrCode%)
DECLARE SUB ExtendFSpec (File$, Ext$, FullFile$, ErrCode%)
DECLARE SUB FindFirstFx (Buffer$, FileName$, BYVAL Attr%, ErrCode%)
DECLARE SUB FindNextFx (Buffer$, ErrCode%)
DECLARE SUB ParseFSpec (FileSpec$, Drive$, DLen%, Subdir$, SLen%, File$, FLen%)

SUB FileCopy (Source$, Dest$, FileCount%, ByteCount&, ErrCode%)
FileCount% = 0
ByteCount& = 0

ExtendFSpec Source$, ".", Src$, ErrCode%
IF ErrCode% THEN EXIT SUB
SDrv$ = " "
SDir$ = SPACE$(64)
SFile$ = SPACE$(12)
ParseFSpec Src$, SDrv$, D%, SDir$, S%, SFile$, F%
SDrv$ = LEFT$(SDrv$, D%)
SDir$ = LEFT$(SDir$, S%)
SFile$ = LEFT$(SFile$, F%)
SPath$ = SDrv$ + ":" + SDir$
IF RIGHT$(SPath$, 1) <> "\" THEN SPath$ = SPath$ + "\"

ExtendFSpec Dest$, ".", Dst$, ErrCode%
IF ErrCode% THEN EXIT SUB
DDrv$ = " "
DDir$ = SPACE$(64)
DFile$ = SPACE$(12)
ParseFSpec Dst$, DDrv$, D%, DDir$, S%, DFile$, F%
DDrv$ = LEFT$(DDrv$, D%)
DDir$ = LEFT$(DDir$, S%)
DFile$ = LEFT$(DFile$, F%)
DPath$ = DDrv$ + ":" + DDir$
IF RIGHT$(DPath$, 1) <> "\" THEN DPath$ = DPath$ + "\"

IF INSTR(SFile$, "*") OR INSTR(SFile$, "?") THEN
IF INSTR(DFile$, "*") = 0 AND INSTR(DFile$, "?") = 0 THEN
ErrCode% = -1
EXIT SUB
END IF
END IF

Buffer$ = SPACE$(64)
FindFirstFx Buffer$, Src$, 0, ErrCode%
DO UNTIL ErrCode%
tmp$ = GetNameFx$(Buffer$)
FromFile$ = SPath$ + tmp$
ToFile$ = DPath$ + ForceMatch$(DFile$, tmp$)
IF FromFile$ = ToFile$ THEN ErrCode% = -2
IF ErrCode% = 0 THEN CopyFile FromFile$, ToFile$, ErrCode%
IF ErrCode% = 0 THEN
FileCount% = FileCount% + 1
ByteCount& = ByteCount& + GetSizeFx&(Buffer$)
FindNextFx Buffer$, ErrCode%
END IF
LOOP

IF ErrCode% = &H12 THEN ErrCode% = 0
END SUB


  3 Responses to “Category : BASIC Source Code
Archive   : PBC30B.ZIP
Filename : FILECOPY.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/