From: Joel VanderWerf Date: 2009-04-29T01:32:24+09:00 Subject: Re: How Check File Busy? Greg Willits wrote: > I want to use Ruby to periodically move files out of an FTP upload > folder to another location. Before I move any one file, I need to know > that it is not in the middle of being uploaded. > > Other than doing something really barbaric like check the file size, > wait some time period and check the size again, I can't figure out how > Ruby would know if a file not in use by Ruby itself is "busy." As long as the place you are moving the file to is on the same partition, why can't you just move it and let the upload proceed? If the writer has an open file handle, it will keep writing to the same file. Of course, if the writer opens a new file handle each time data comes in, then this won't work. And maybe you don't want new writes after the file is moved, because of your application logic. So probably Robert Klemme's suggestion to use fuser is apt. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407