Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Perl Q: how to check if a file is "busy"

Jean-Christian Imbeault wrote:
> I wrote a very simple perl program to mv some files around. But 
> unfortunately it cannot tell when a file it is tryig to "mv" is 
> currently being written to and shouldn't be moved until it is no longer 
> bing written to.
> What are some mechanisms I can use to wait until a file is "free" before 
> mv'ing it? Are there any system calls I could us that do this?

How about lsof?

lsof | grep filname

There are probably more efficient ways to use lsof, and I sure they are 
hiding somewhere in the terribly dense man page...

Josh Glover <>

Associate Systems Administrator

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links