Announcement

Collapse

New Sub-Forum

In an effort to help make sure there are appropriate categories for topics of discussion that are happening, there is now a sub-forum for databases and database programming under Special Interest groups. Please direct questions, etc., about this topic to that sub-forum moving forward. Thank you.
See more
See less

Backing Up Files

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

  • Backing Up Files

    What is an easy code to back up and restore files on a floppy without destroying the information already on the files before backup is complete. Ex. "backup.dat is on the floppy, but I want to change it to backup.bak" on the same floppy without destroying backup.dat.

    Also, How can I check two files and see if they contain the same date and information?
    Please help.

  • #2
    For the 1st part of your question, you might use DIR$ to check for file specs on the "A:\" drive. If the file exists, you can do with it just about anything you want with it. For example:

    test$ = dir$("a:\sometext.dat")
    if test$ <> "" then
    NAME "a:\sometext.dat" AS "a:\sometext.bak"
    end if

    For the 2nd part of your question, check to see if COMP is anywhere on your drive. This utility checks the contents of any two files and COMPares them.



    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      COMP is not part of Windows 95/98, but FC (File Compare) is part of all Windows and MS-DOS systems.

      But unless FC returns an ERRORLEVEL that your program (or a batch file) can detect -- I don't know -- I'm not sure that it will be very useful. If you're doing this with PB you will probably need to open both files and compare them byte-to-byte. Even then, the files may be identical but the date stamps may be different, so you'd need code to check that too (if the date stamp matters). FC does not compare the date stamps.

      The first part of your question is unclear to me. You say "before backup is complete". Please clarify...? A more detailed example might help.

      -- Eric

      ------------------
      Perfect Sync: Perfect Sync Development Tools
      Email: mailto:[email protected][email protected]</A>

      "Not my circus, not my monkeys."

      Comment


      • #4
        Eric,

        For what it's worth, the date stamp is part of the directory entry; it is not part of the file itself. FC compares the contents of two files, not their directory entries.

        To compare the date stamp, you need to do a DIR$ (or equivalent assembler code) and then check the FCB for the encoded date and time.

        Alan

        ------------------
        Alan C. Earnshaw
        Information Management Systems, Inc.
        http://www.infoms.com
        Alan C. Earnshaw
        Information Management Systems, Inc.
        http://www.infoms.com

        Comment


        • #5
          Hi Alan (long time no hear) --

          Understood. Keith specifically asked...

          > How can I check two files and see if they
          > contain the same date and information?

          ...and I was pointing out that FC won't do the date part. I think we're saying the same thing.

          -- Eric


          ------------------
          Perfect Sync: Perfect Sync Development Tools
          Email: mailto:[email protected][email protected]</A>

          "Not my circus, not my monkeys."

          Comment


          • #6
            Yes, we are saying the same thing. I was just trying to amplify and/or clarify the point: the date stamp is not stored in the file but in the directory entry.

            Alan

            P.S. It has been awhile. Let's correct that and get together for dinner. (Explanatory note: Eric and I live about 25 minutes from each other, making dinner relatively easy to arrange.)

            ------------------
            Alan C. Earnshaw
            Information Management Systems, Inc.
            http://www.infoms.com
            Alan C. Earnshaw
            Information Management Systems, Inc.
            http://www.infoms.com

            Comment

            Working...
            X