How can I test if a list of files exist?

后端 未结 6 2138
花落未央
花落未央 2021-02-15 18:25

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:17

    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.

提交回复
热议问题