如何在没有用户交互的情况下将文件上传到Ftp服务器? [英] How to Upload a Files to Ftp Server Without User Interaction?

查看:180
本文介绍了如何在没有用户交互的情况下将文件上传到Ftp服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在特定目录中修改或添加文件时。

我需要将这些文件上传到FTP服务器。

在上传这些文件之前我需要显示通知底部任务栏上的图标。

提前感谢你。

When file is modified or added in a particular directory.
I need to Upload those files to FTP server.
And before Uploading those files i need to show notify icon on the bottom task bar.
Thanking you in Advance.

推荐答案

假设你使用winforms或wpf你可以使用 FileSystemWatcher



Assuming your're using winforms or wpf you can use FileSystemWatcher

FileSystemWatcher fsw = new FileSystemWatcher("mydir");
fsw.Changed += new FileSystemEventHandler(fsw_Changed);
fsw.NotifyFilter = NotifyFilters.LastWrite;
fsw.EnableRaisingEvents = true;





fsw将如果文件被修改,则引发事件。

在更改事件中,您可以在托盘或任务栏中运行上传代码和通知。



也许你也想使用像这样的文件过滤器



The fsw will raise the event if the file is modified.
On the change-event, you can run your upload code and the notification in the tray or taskbar.

maybe you also want to use a filefilter like this

FileSystemWatcher fsw = new FileSystemWatcher("mydir", ".dat");


这篇关于如何在没有用户交互的情况下将文件上传到Ftp服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆