When you trying to do manipulation on a large number of files , you need to know if the file is locked for writing ,otherwise you may get critical exceptions caused by msgboxs prompt by the application.
lets take Microsoft Word as example.
If the document that your program is trying to manipulate opened by more than one user ,Then its locked, and if you try to open it by code you will get prompt window that stuck your program.
To avoid this , you can use the function I added , and call it before you open the file
.the function will return Boolean value regarding the file lock state.