Agree with the response of @dsfgsho to a question similar to yours:
When a file is being used it becomes unavailable, so you can check its availability and wait until it becomes available for use.
void AguardaArquivo()
{
// Seu aqruivo
var file = new FileInfo("caminho/do/arquivo");
// Enquanto o arquivo não está acessível, deve estar sendo copiado
while (IsFileLocked(file)) { }
// A partir daqui o arquivo está disponível
}
/// <summary>
/// Code by ChrisW -> https://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use
/// </summary>
protected virtual bool IsFileLocked(FileInfo file)
{
FileStream stream = null;
try
{
stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
}
catch (IOException)
{
return true;
}
finally
{
if (stream != null)
stream.Close();
}
//file is not locked
return false;
}
Compare his size?
– Jéf Bueno