Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check if directory is in use?

Status
Not open for further replies.

chazoid

Technical User
Dec 2, 2002
300
US
Is there a way to tell if a directory is in use by another program?

I have a (non-perl) program running on win2k which does this..
It creates a folder and starts filling it with data until it reaches a size anywhere from 500MB to 550MB.
When it's done with the first folder it creates another one and so on...

I want to be able to check each folder periodically to see if it's complete but I'm not sure what the best way to do this is. Currently the perl script trys to rename the folder until it's successful:

$rtn = 0;
while ($rtn == 0){
$rtn = rename($oldName, $newName) or warn "still processing...\n\n";
sleep(10);
}
print qq($oldName has been renamed\n\n);

This works, but doesn't seem very reliable to me.. is there a way to check if another program has a handle on a directory?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top