Page 1 of 1
FTP check if file already exists
Posted: Tue Jun 10, 2014 12:21 pm
by Amor_2001
Hello,
how can I check if a file already exists on an FTP server with a function similar to FileSize() in a normal Directoy ?
Best Regards
Re: FTP check if file already exists
Posted: Tue Jun 10, 2014 12:33 pm
by Shield
Just open a connection, navigate to the target directory and check with ExamineFTPDirectory()
whether there is a file with the specific name you're looking for. Examples can be found in the help file.

Re: FTP check if file already exists
Posted: Tue Jun 10, 2014 1:10 pm
by Amor_2001
The method with ExamineFTPDirectory () I have already tried. I have about 200 files in a array that I need to check. This takes quite a long time.
Here's an example of my code:
for i=1 to FileCount
If ExamineFTPDirectory(1)
While NextFTPDirectoryEntry(1)
If LCase(FTPDirectoryEntryName(1)) = Lcase(Filename(i))
Debug "File "+Filename(i)+" exist"
Continue
Else
Debug "File "+Filename(i)+" not exist"
EndIf
Wend
EndIf
Next
The code does not run correctly. Can you help me?