Board index » delphi » I can't run Dos Commands

I can't run Dos Commands

I want to back up of   *.dbf files on floppy.
So I think I should use dos  commands such as
COPY, ARJ,e.t.c .
Thanks,
 

Re:I can't run Dos Commands


Hi,

You can copy from inside Delphi with function CopyFile(FromFile, ToFile);
You can execute any apllication from Delphi using WinExec() or
CreateProcess().
If you want to use DOS, I suggest :
- Make a (.bat) file with the commands you want - copy, arj, and so...
- Call it from Delphi with WinExec() or, preferably with CreateProcess().
(WinExec is discontinued but it's interpreted as a particular call do
CreateProcess().)

Best Regards,

--
Elio Medeiros
Rio de Janeiro - Brasil
e-mail <el...@hotmail.com>

Re:I can't run Dos Commands


Hello, YUKU. I think you must use Jordan Russell's ZLib unit' features to
backup/restore your database files.

Zdravko.

-----------------
Deflate/inflate compression unit for Delphi versions 1, 2, and 3; Version
1.1m by Jordan Russell

  Nearly all credit for this goes to the original authors of the zlib
  compression library, Jean-loup Gailly and Mark Adler. This unit is based
on
  zlib version 1.1.1. The complete code for zlib compression library,
written
  in C, can be found at:
  http://www.cdrom.com/pub/infozip/zlib/

Quote
}

..............
    AssignFile (SourceFile, 'backup.z');
    FileMode := fmOpenRead;  Reset (SourceFile, 1);
    try
      StartOffset := FilePos(DiskFile);
      OriginalSize := FileSize(SourceFile);
      BlockWrite (DiskFile, ZLIBID, SizeOf(ZLIBID));
      DeflateData (SourceFile, OriginalSize, True,
        DiskFile, -1, True, CompressLevel, CompressedSize, Adler);
        { no need to check result of DeflateData since there's no
        possibility of it running out of write space since we specified
        -1 for the destination size }
    finally
      CloseFile (SourceFile);
    end;
..............

Re:I can't run Dos Commands


Quote
YUKU wrote:

> I want to back up of   *.dbf files on floppy.
> So I think I should use dos  commands such as
> COPY, ARJ,e.t.c .
> Thanks,

You can also use the functions stored in the Demo
FILEMANEX.DPR which comes with Delphi. This will
show you how to copy, move, delete, etc files or
entire directories.

I suggest use the FMXUTILS.PAS file in your project,
so you have access to all these functions, or browse
through this file, so you can see how to execute the
code yourself.

HTH

Adam

Other Threads