-1

I know for sure that the file exists on Samba share. But file.exists() return 'false' for it. Another system puts this file in a Samba share folder and notifies our application that the file is uploaded. Than we invoke file.exists() for check this and get 'false'

Path sourceFile = ... 
sourceFile.toFile().exists() 
//return 'false' for existing file with path like \\share1\mc\logs.txt

Maybe the file has not yet been completely written or has not been completely closed, could that affect the result file.exists()?

Dor
  • 657
  • 1
  • 5
  • 11
Sorand
  • 115
  • 15

1 Answers1

1

Well, at least the behaviour you're observing is covered by the documentation

false if the file does not exist or its existence cannot be determined

(emphasis added).

Might be related to this question here: Why does 'File.exists' return true, even though 'Files.exists' in the NIO 'Files' class returns false, though the answers seem a bit inconclusive to me.

Dor
  • 657
  • 1
  • 5
  • 11
Volker Stolz
  • 7,274
  • 1
  • 32
  • 50