Need best method to test whether a remote director - WeOnlyDo Discussion board

Need best method to test whether a remote director (General questions)

by kevino, Wednesday, May 18, 2011, 17:43 (4936 days ago)

I need to mimic my local directory structure to a FTP server. Is there a best method to iterate through folders locally and makedir them remotely? Part of this involves knowing how to test for the existence of a remote directory.

Re: Need best method to test whether a remote dire

by wodDamir, Wednesday, May 18, 2011, 17:50 (4936 days ago) @ kevino

Hi Kevin,

The easiest way to upload a whole directory structure would be to use PutFiles method.

As for checking if folder exists on remote side, you would need to use RealPath method, or try getting a directory structure using i.e. ListAttributes method. This will trigger AttributesData event which you can use to iterate through specific items (files, directories etc.).

Hope this helps.

Regards,
Damba

Re: Need best method to test whether a remote dire

by kevino, Wednesday, May 18, 2011, 17:57 (4936 days ago) @ wodDamir

Hi Kevin,

The easiest way to upload a whole directory structure would be to use PutFiles method.

is there an option for putFiles to skip existing files on the remote end?

Re: Need best method to test whether a remote dire

by wodDamir, Wednesday, May 18, 2011, 18:06 (4936 days ago) @ kevino

Kevin,

If you set Resume property to True, the component will try to resume. However, if they're already complete, the component will not try to re-upload the file (will skip it).

There's no specific option which would check for a file and not upload it. However, if you use AttributesData as suggested, you can make your collection of files on the server and decide if you wish to upload it in PutFiles call by specifying Skip parameter in LoopItem event (more info on http://www.weonlydo.com/SFTP/Help/wodSFTP-LoopItem-Event.html).

Regards,
Damba