Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You need to access information about a file, such as its size or last modification date. In doing so, you want to avoid the possibility of race conditions.
Use a secure directory, as described in Recipe 2.4. Alternatively, open the file and query the needed information using the file handle. Do not use functions that operate on the name of the file, especially if multiple queries are required for the same file or if you intend to open it based on the information obtained from queries. Operating on filenames introduces the possibility of race conditions because filenames can change between calls.