[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Run a program on file close

Posted on 2004-09-01
6
Medium Priority
?
145 Views
Last Modified: 2011-09-20
And/or notify a program that a file has been closed

I would like to write a little program that will backup files as they are saved.  I would like this to be automatic so that any application on Windows that saves a file will notify my program and my program can take a copy.

Is this possible? if it is, how would one go about it?

Cheers,

Bob
0
Comment
Question by:doubledrat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 375 total points
ID: 11952511
you may take a look to the ReadDirectoryChangesW-API
or look at www.torry.net for directory-monitoring components

meikl ;-)
0
 
LVL 4

Expert Comment

by:Evarest
ID: 11952538
I don't think it's a very good idea to let your program scan for _all_ saves of all programs. You might end up with a lot of junk in your backups.

You have two alternatives:

 1) Let other programs monitor all folders you need to backup.

When a certain file is changed in that folder, you can send a parameter with the path to that file to any program you like. This way, you can always wrap around a program that will do the backup, but the monitoring, you won't have to worry about anymore.
 A program that's capable of sending such dynamic parameters to any program is DirMonitor, which you can download from

http://www.download.com/DirMonitor/3000-2092-10306780.html?tag=WinTracking&part=rss&subj=newwin

 2) Do the monitoring yourself:
Create a program that will monitor folders for changes, log these changes and every now and then backup the modified files.
This will involve you writing a program that monitors AND a program that does the backups. Enjoy :-)

 3) If you really want to check every program for savings, you might try out hooks. I don't know whether there is a message when something saves data.
Another possibility is a shellnotify, but in my experience, these tend to be inaccurate and memoryleaking tools. Shellnotify will execute an event when a file is changed or modified in Explorer (thus your computer)...

Evarest
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11952539
more explicit pointing to vcls

http://www.torry.net/pages.php?id=252
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 11970555
maybe this is too simple:

if you know which directories should be saved by your program (i doubt
you want to save all windows files that are changing all the time) then you can
generate a list of the files with their dates (creation and modified).
start a check every 5 minutes or so and then copy
all changed or new files.

if you make the interval quite short there will be a very small possibility that a
file is not saved before the hard drive breaks down (as the break downs don't
happen too often ;-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question