By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

a windows service to delete files

P: n/a
It seems that I will soon have to write a windows service (or if there's
something more appripriate?) that will delete files off of a hard drive.

Here's an example, a file will be placed in a directory, at the time it is
placed there, a row will be inserted into an RDBMS table which gives the
filename, the location (could be on various servers), its time-to-live (like
2 days) and the datetime it was placed there, and probably a flag indicating
that it was deleted or not (like 0 or 1). Then I assume my application or
service will query the table periodically and if any files that have not
been deleted and their time is up, then it will delete them.

any comments on how I should do this?
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Keith,

You could use the FileSystemWatcher class of .NET for this. Something like:
- you set the filesyswatcher to 'watch' the folder in question.
- when a file is copied into that folder, an event will be fired which you
could handle. Within that, you could easily call the DB and insert a row.
HTH,
- Rakesh Rajan

"Keith Henderson" <kh********@projectresources.nospam.com> wrote in message
news:u9**************@TK2MSFTNGP15.phx.gbl...
It seems that I will soon have to write a windows service (or if there's
something more appripriate?) that will delete files off of a hard drive.

Here's an example, a file will be placed in a directory, at the time it is
placed there, a row will be inserted into an RDBMS table which gives the
filename, the location (could be on various servers), its time-to-live (like 2 days) and the datetime it was placed there, and probably a flag indicating that it was deleted or not (like 0 or 1). Then I assume my application or
service will query the table periodically and if any files that have not
been deleted and their time is up, then it will delete them.

any comments on how I should do this?

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.