Announcement

Collapse
No announcement yet.

Copying Across Drives

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copying Across Drives

    I'm trying to do this:

    ON ERROR GOTO ERRORHANDLER
    SHELL "COPY A:\DATA.BAK" ' Copy this file to C drive from A drive
    ON ERROR GOTO 0
    IF "DATA.INP" <> "" THEN KILL"DATA.INP" 'if file exists delete it
    NAME "DATA.BAK" AS "DATA.INP" ' rename backup file as main file
    END IF
    IF "DATA.BAK" <> "" THEN 'prove the file was restored
    PRINT" THE DATA HAS BEEN RESTORED TO THE HARD DRIVE"
    ELSE
    PRINT "THE DATA WAS NOT TRANSFERRED FROM THE FLOPPY DRIVE"
    END IF
    ************

    The computer will not recognize the data.bak file on the floppy
    disk (I know the file is there). So, what is wrong with this code?
    Please help.
    Thanks. Keith

  • #2
    Keith,
    Other than a small error (you omitted DIR$() ), it works fine.
    file rewritten:
    Code:
     
    SHELL "COPY A:\DATA.BAK" ' Copy this file to C drive from A drive
    IF DIR$("DATA.INP") <> "" THEN KILL"DATA.INP" 'if file exists delete it
    NAME "DATA.BAK" AS "DATA.INP" ' rename backup file as main file
    ' Note that DATA.BAK has already been renamed,
    ' Now you have to test for the existance of the New Name!
    IF DIR$("DATA.INP") <> "" THEN 'prove the file was restored
      PRINT" THE DATA HAS BEEN RESTORED TO THE HARD DRIVE"
    ELSE
      PRINT "THE DATA WAS NOT TRANSFERRED FROM THE FLOPPY DRIVE"
    END IF
    '************
    ------------------
    [email protected]
    :) IRC :)

    Comment

    Working...
    X