Discussion:
Backup application in D4 and TApplicationEvents
(too old to reply)
P E Schoen
2011-01-02 22:43:22 UTC
Permalink
I don't fully trust most of the backup programs I've found and tried to use,
and I usually just do a manual backup by copying critical and recently
modified files and folders to an external drive or CDROM. I thought it would
be good to use Delphi to create an application that automates this process
and allows me to add or change things to my own needs. But it seemed a waste
of time to start from scratch so I searched for an existing app with source
code as a starting point.

I downloaded this "Backup Machine", which seemed promising:
http://delphi.about.com/od/fullcodeprojects/l/aa033004a.htm. However, when I
tried to open the project with D4pro there were multiple errors which I
found were caused by a missing TApplicationEvents component. I found what
was supposed to be a free download for this but the link went to some crap
website. (Tong software or xentrix.net)

Before I waste more time searching with no joy, does anyone have any
suggestions for obtaining a Delphi project and source code that will work on
D4, or even good suggestions for a backup program? Is the built-in backup
utility in Win7 any good? I've had terrible experience with the Western
Digital Smartware that came with the "My Passport" external drive, and the
NCH software "FileFort" http://www.nchsoftware.com/backup/index.html was not
very good IMHO. I don't want an app that uses a proprietary backup format.
Just filenames and perhaps a date-time stamp added. And maybe zipfiles.

Thanks!

Paul
Bart
2011-01-02 23:50:05 UTC
Permalink
Op Sun, 2 Jan 2011 17:43:22 -0500 schreef "P E Schoen"
<***@pstech-inc.com>:

Well, I have a Stupid Backup Program, written in Lazarus (Delphi
originally).
It just copies entire folders with or without subfolders and handles
in- and exclusionfilters.
No compressing of files is performed.

It can handle UNC filepaths and it should be able to backup directly
to CD-RW (if you use packet writing software).

A slightly outdated version can be found at:
http://home.tiscali.nl/~knmg0017/software/sbp_bron.zip
sources, or
http://home.tiscali.nl/~knmg0017/software/sbp.zip
(binary)

If you find it interesting, Ill update the sources for you (mainly
bugfixes).

Bart
--
Bart Broersma
***@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
P E Schoen
2011-01-03 01:24:01 UTC
Permalink
Post by Bart
Well, I have a Stupid Backup Program, written in Lazarus
(Delphi originally).
It just copies entire folders with or without subfolders and
handles in- and exclusionfilters.
No compressing of files is performed.
It can handle UNC filepaths and it should be able to backup
directly to CD-RW (if you use packet writing software).
http://home.tiscali.nl/~knmg0017/software/sbp_bron.zip
sources, or
http://home.tiscali.nl/~knmg0017/software/sbp.zip
(binary)
If you find it interesting, Ill update the sources for you
(mainly bugfixes).
Thanks for the files, but I did not see a Delphi Project file and I was not
sure if it was OK to just run the EXE without learning a little more about
the details.

What I would like to do is make a list of files and directories that I want
to back up, and then have the software look in the destination drive and see
if the file exists and if the source file is newer or different. I would
then rename any existing older file with a datetime stamp and then copy the
newer version.

I'd also like to be able to have the software run in the background and
detect anytime a file is modified and saved. In this case it would probably
be best to just continue to update the backup file without creating a
previous version file.

I found some backup programs here:
http://wareseeker.com/free-delphi-backup-components/

and some possibly useful code here:
http://www.awitness.org/delphi_pascal_tutorial/source/disk_search_recursive.html

Thanks,

Paul
Bart
2011-01-03 11:26:35 UTC
Permalink
Op Sun, 2 Jan 2011 20:24:01 -0500 schreef "P E Schoen"
Post by P E Schoen
Thanks for the files, but I did not see a Delphi Project file and I was not
sure if it was OK to just run the EXE without learning a little more about
the details.
*.lfm -> *.dfm
*.lpr -> *.dpr
*.pp -> *.pas

That would make it probably possible to open the project in Delphi.
Post by P E Schoen
What I would like to do is make a list of files and directories that I want
to back up, and then have the software look in the destination drive and see
if the file exists and if the source file is newer or different. I would
then rename any existing older file with a datetime stamp and then copy the
newer version.
The main engines in the program are EnumDirs
(http://home.tiscali.nl/~knmg0017/software/fpc_laz/enumdirs.zip) (a
compnent that traversed directories) and ExtMasks
(http://home.tiscali.nl/~knmg0017/software/fpc_laz/extmasks.zip) (that
handles in- and exclusionmasks).
(You won't need fpc_patches used by EnumDir if your using Delphi)

This will give you almost all you need to recurse diretories and have
any file (based on the inclusion and exclusion filter) passed through
a callbackroutine.

All the rest is just errortrapping, gui and saving/restoring options.

Sources are LGPL licensed.

Happy coding,

Bart
--
Bart Broersma
***@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
a***@aol.com
2011-01-05 06:05:13 UTC
Permalink
Post by P E Schoen
What I would like to do is make a list of files and directories that I want
to back up, and then have the software look in the destination drive and see
if the file exists and if the source file is newer or different. I would
then rename any existing older file with a datetime stamp and then copy the
newer version.
I'd also like to be able to have the software run in the background and
detect anytime a file is modified and saved. In this case it would probably
be best to just continue to update the backup file without creating a
previous version file.
<snip>

I think you would be better using the file's Archive attribute, which
is changed by the system when a file is modified. You then revert it
when you back-up the file.

Ther are also system events to tell you when a file is changed,
FindFirstChangeNotification is the keyword for this process.

Alan Lloyd

Maarten Wiltink
2011-01-03 08:42:45 UTC
Permalink
"P E Schoen" <***@pstech-inc.com> wrote in message news:fc7Uo.7848$***@newsfe08.iad...

[...]
Post by P E Schoen
http://delphi.about.com/od/fullcodeprojects/l/aa033004a.htm. However,
when I tried to open the project with D4pro there were multiple errors
which I found were caused by a missing TApplicationEvents component.
I found what was supposed to be a free download for this but the link
went to some crap website. (Tong software or xentrix.net)
I know TApplicationEvents was added at some point; apparently it was in
a later version.

Reproducing it by setting events on Application in code shouldn't be
too hard.
Post by P E Schoen
Before I waste more time searching with no joy, does anyone have any
suggestions for obtaining a Delphi project and source code that will
work on D4, or even good suggestions for a backup program? Is the
built-in backup utility in Win7 any good? I've had terrible experience
with the Western Digital Smartware that came with the "My Passport"
external drive, and the NCH software "FileFort"
http://www.nchsoftware.com/backup/index.html was not very good IMHO.
I don't want an app that uses a proprietary backup format. Just
filenames and perhaps a date-time stamp added. And maybe zipfiles.
Hmm. You are describing Robocopy, not backups.

Groetjes,
Maarten Wiltink
Hans-Peter Diettrich
2011-01-03 13:21:21 UTC
Permalink
Post by P E Schoen
I don't fully trust most of the backup programs I've found and tried to
use, and I usually just do a manual backup by copying critical and
recently modified files and folders to an external drive or CDROM. I
thought it would be good to use Delphi to create an application that
automates this process and allows me to add or change things to my own
needs.
I don't backup projects any more. Instead I make snapshots of my VM, or
use a version control system (Git) for tracking all experiments and
changes to a project. A Git repository is easy to backup, just copy the
.git directory somewhere else.

DoDi
Loading...