Home > Archive > PERL Beginners > March 2005 > Is file finished writing? Can't use foo.lock!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Is file finished writing? Can't use foo.lock!
|
|
| David Jacopille 2005-03-24, 8:56 pm |
| Unfortunately it's not my process that's writing the file. I tell the
page layout application to print-to-pdf which spools the job followed
by another application: the system's "Print Monitor" launching and
actually processing the job to postscript - and that application can
keep running with hundreds of files in the spool so merely waiting for
the application to quit/idle could take forever.
While the foo.lock is a good idea I would still have to somehow detect
that the system's "Print Manager" is done writing the file to know
when to remove the foo.lock - which means I'm back to needing the
ability to ask ask when the file is finished writing. If I can
successfully do that I wouldn't need the foo.lock.
Thanks,
Dave
On Mar 23, 2005, at 11:35 PM, JupiterHost.Net wrote:
>
>
> David Jacopille wrote:
>
>
> make foo.lock when you open foo to work on and remove foo.lock when
> you're done.
>
> don't open it if the foo.lock exists
>
> Search cpan for file and lock file tools
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
| |
| Thomas Bätzler 2005-03-24, 8:56 pm |
| David Jacopille <titanium9@mac.com> wrote:
[...]
> While the foo.lock is a good idea I would still have to
> somehow detect that the system's "Print Manager" is done
> writing the file to know when to remove the foo.lock - which
> means I'm back to needing the ability to ask ask when the
> file is finished writing. If I can successfully do that I
> wouldn't need the foo.lock.
What's your target OS? On Win32 you could try and do nasty
things like trying to open a file for writing (in append
mode) to find out if it's still being written to.
On Linux, you might be able to move the destination file to
another directory while it's still being written to. You could
then chekc the directory to see when a new file is created,
which would presumably mean that the spooler would be done
with your file.
Just my $0.02,
Thomas
|
|
|
|
|