How can I test if a list of files exist?

后端 未结 6 1888
粉色の甜心
粉色の甜心 2021-02-15 18:38

I have a file that lists filenames, each on it\'s own line, and I want to test if each exists in a particular directory. For example, some sample lines of the file might be

6条回答
  •  臣服心动
    2021-02-15 19:08

    Please note, however, that using the default file systems under both Win32 and *nix there is no way to guarantee the atomicity of the operation, i.e. if you check for the existence of files A, B, and C, some other process or thread might have deleted file A after you passed it and while you were looking for B and C.

    File systems such as Transactional NTFS can overcome this limitation.

提交回复
热议问题