Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access to a file closed?

0 views
Skip to first unread message

al...@vp.pl

unread,
Oct 12, 2006, 5:34:40 PM10/12/06
to
How can I check whether an access to a file is closed? I have a DB job
which dumps DB into a file, every 1 hour. This file is usually around
10GB. I have written another DOS script which compresses the DB dump. Is
there a way to check that the DB dump is complete and it is safe to
start zipping the file?

Thanks
Aleu

Timo Salmi

unread,
Oct 12, 2006, 5:42:10 PM10/12/06
to

A typical trick is to create a lockfile for the duration of a task,
and delete it as the last action. Then your second application or a
rerun can check if the lockfile exists, and exit if it does.

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip

Mark V

unread,
Oct 12, 2006, 6:44:36 PM10/12/06
to
In alt.msdos.batch.nt al...@vp.pl wrote:

(not pure batch) but perhaps you can check for an open file handle to
the file using such as Sysinternals HANDLE.EXE CLI utility.

al...@vp.pl

unread,
Oct 12, 2006, 8:11:16 PM10/12/06
to
al...@vp.pl wrote:
> How can I check whether an access to a file is closed?

Thanks for the hints guys.

Aleu

Ted Davis

unread,
Oct 12, 2006, 8:46:48 PM10/12/06
to

Generally speaking, if the file is open, you cannot rename it. If you
can rename it, it's closed, but being closed does not necessarily mean
that the originating program is done with it.

--
T.E.D. (tda...@gearbox.maem.umr.edu) Remove "gearbox.maem" to get real address - that one is dead

billious

unread,
Oct 12, 2006, 10:11:58 PM10/12/06
to

<al...@vp.pl> wrote in message news:egmcdh$af$1...@news.onet.pl...

You could look at its length, wait a few seconds and then look at its length
again.

Or do a DIR list, wait, repeat the dir list and compare.


Todd Vargo

unread,
Oct 14, 2006, 8:03:28 PM10/14/06
to

"Ted Davis" <tda...@gearbox.maem.umr.edu> wrote in message
news:gcoti2lf2704mel3e...@4ax.com...

> On Thu, 12 Oct 2006 17:34:40 -0400, "al...@vp.pl" <al...@vp.pl> wrote:
>
> >How can I check whether an access to a file is closed? I have a DB job
> >which dumps DB into a file, every 1 hour. This file is usually around
> >10GB. I have written another DOS script which compresses the DB dump. Is
> >there a way to check that the DB dump is complete and it is safe to
> >start zipping the file?
> >
>
> Generally speaking, if the file is open, you cannot rename it. If you
> can rename it, it's closed, but being closed does not necessarily mean
> that the originating program is done with it.

Another method to check if a file is open is to attempt to change attribute.
Of course, having better details about how the dump is initiated and why
would be nice too.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

0 new messages