[Gllug] Checking if a file has finished being written?

Andrew Halliwell ah at gnd.com
Mon Jan 27 15:12:42 UTC 2003


> Hi all,
> 
> I wonder if anyone can tell me a way to check in a shell script if a file
> has finished being written?
> 
> I want to automatically transcode from one type of video to another, but
> there is a likely chance of hitting a file mid write if I just do this on a
> timed basis.
> 
> I unfortunately have no control over the source application setting some
> sort of flag file to show the write is complete.

Well... Assuming you know the name of the file (perhaps even knowing the
name of the application would be enough), fuser and lsof provide a lot of
information concerning files. If the application can be forced to close the
file on write completion, looking at lsof (list open files) would list the
file while it's being written.

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list