(E-Mail Removed) wrote:
> Is it possible to delete a file by copying it to the "bit bucket" or
> "null device"?
<snip>
Just a comment to your service. I've implemented several such services
in various ways and one thing I've found is that it's impossible for me
to guarantee that the system will work in all situations.
There could be a multitude of sources for errors that can crop up and at
some point you're going to loose a file, or try to figure out wether a
file was processed or not.
I found that by always moving the file to a "successful" directory after
processing it, or an "error" directory in case of problems, the user
always knows that whatever happens (network problems, database
crash/rollback/restore, disk full, etc.) they can always find their
files and just move them back into the processing directory to reprocess
them.
The problem I was left with then was that this directory quickly filled
up, but after a time, old files are no longer interesting nor necessary
so I just added code to the service to take a look in this directory
from time to time and delete all files older than X days (14 in most
cases) to keep its size down.
In any case, a simple change for your program would be that your program
accepts an empty directory name as the successful target, and in that
case the program just uses File.Delete to remove the file instead of
File.Move.
--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
private.php?do=newpm&u=
PGP KeyID: 0x2A42A1C2