I monitor files that are dropped on a ftp via filesystem watcher then move to another dir. Now I trigger the copy off the create event of the filesystem watcher but obviously i
When file gets copied from another server using FTP, before complete file copy , file name gets renamed with extra extension like .TMP as shown in path example below.
C:\InterfaceServer\OilAndGas\XMLForTest\TestStbFile.xml.TMP
To overcome this situation follow two steps
You need to just call the below method to remove the extra extension and add wait for 2 seconds in the code so that the complete file gets created and you can use it for further processing.
public static string VerifyIfStubFile(string filePath, string extension)
{
if (filePath.Length - (filePath.IndexOf(extension) + extension.Length) != 0)
{
/*LogMsg("Info : VerifyIfStubFile : Stub file found. Lets fix it!!"); */
return filePath = filePath.Substring(0, (filePath.IndexOf(extension) + extension.Length));
}
return filePath;
}