I want to programmatically rename a file and it could be open. It's a log file. When I was testing my code the rename part didn't work because the log file TestPro.log was open by the TAF (Test Automation Framework).

When TestPro is running and I try to delete the file I get the error *"Cannot delete because is being used by another person or program."*

Is there any way how to rename a file (programmatically) that is open the way the log file was?