Upload only new/updated files using SFTP (General questions)
Using SFTP (non .NET SFTP) what code would be required in VB/VB.NET to compare source and destination files and upload (PutFiles) only new and updated files.
by Davefyfe, (6252 days ago)
Using SFTP (non .NET SFTP) what code would be required in VB/VB.NET to compare source and destination files and upload (PutFiles) only new and updated files.
by wodDamir
, (6252 days ago) @ Davefyfe
Hi Dave,
wodSFTP doesn't compare on it's own, so this is something that you will have to implement. I would suggest that you try using GetAttributes method, along with Attributes event, to check properties (such as Date and size) of remote file and only call Putfile for file that satisfies your condition.
Also, when doing multiple file uploads, you can use ListAttributes method and AttributesData event instead, since ListAttributes will list properties for each file found in specified directory. You can then compare local and remote file, and create a list of files that need to be uploaded.
Hope this helps.
Regards,
Damba
by Brad Jensen, (5283 days ago) @ wodDamir
I've looked for sample code on your site to do this, which I think would be a common thing. I want to use putfiles to upoload a set of directories and contents, doing the same thing each day.
Obviously I only want to upload the item if it is new or the file date/time has changed.
Can I use putfiles to do this, then within the loopitem event do a getattributes on the remote (server) file so I can compare it to the file I think I want to upload? Or will doing the getattributes break the putfiles process - causing it to stop after the frist file?
If this method won't work, does anyone have an example of iterating thru directories on the local server, then uploading only the new or changed files to the ftp server, preserving the directory structure?
by woddrazen
, (5283 days ago) @ Brad Jensen
Brad,
You need to compare first file date/time and then upload new one to server. In order to receive date/time of file tha tis on server, you can use GetAttributes Method or you can receive it inside DirItems collection.
More help for DirItems collection you can find here:
http://www.weonlydo.com/FtpDLX/Help/wodFtpDLX-DirItem.html
After you compare files, you can upload only new one using PutFile Method.
Drazen

...with WOD's excellent support I was able to bypass Winsock and focus on the task at hand...

...with WOD's excellent support I was able to bypass Winsock and focus on the task at hand...

Many thanks for your excellent support service. I can see why you have a long list of excellent testimonials on your website.

The SFTP ocx is one of the finest pieces of programming I have seen. It worked out of the box...

Congratulations on an excellent product and first rate support!

Thank you very much for the rapid responses. I was a little nervous about dealing with a company that is on a different continent from me. You have proven my concerns to be unfounded.

You did a great job on wodSSH and wodSSHServer! I got a lot for very little money. Thanks!

...your service has been phenomenal. It's always quick and you are there when I need you.

The people at WeOnlyDo are amazing! ... I always get a super fast response from customer service, and the products are great too. Thanks WeOnlyDo

Count us as a satisfied WeOnlyDo customer. We appreciate your terrific support to get the secure Telnet working properly.

