关于异地文件查找问题

mawenyi1978 2009-06-26 06:06:41
加精
现在有个这样的问题,我要查找局域网中某一台电脑中的某一个或者多个文件,查找到后拷贝到本机,希望大家给点思路,能给点代码更好。感谢大家了
...全文
124 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjx2388 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yjytiantang 的回复:]
我这有个源程序例子,发你邮箱过来,我传给你。
[/Quote]

传到资源去,大家都看看
hanjoe109 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yjytiantang 的回复:]
我这有个源程序例子,发你邮箱过来,我传给你。
[/Quote]

能否也給我一份,謝謝!
hanjoe109@163.com
yanghailong11 2009-06-26
  • 打赏
  • 举报
回复
很好很强大
yjytiantang 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 XD19861130 的回复:]
引用 13 楼 yjytiantang 的回复:
引用 10 楼 softroad 的回复:
引用 4 楼 yjytiantang 的回复:
我这有个源程序例子,发你邮箱过来,我传给你。

发送OK.



跪求一份~万分感谢~
xd8171@126.com
[/Quote]


OK,知识共享,仅供参考。
XD王 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 yjytiantang 的回复:]
引用 10 楼 softroad 的回复:
引用 4 楼 yjytiantang 的回复:
我这有个源程序例子,发你邮箱过来,我传给你。

发送OK.
[/Quote]

跪求一份~万分感谢~
xd8171@126.com
mawenyi1978 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 yjytiantang 的回复:]
引用 8 楼 mawenyi1978 的回复:
to:yjytiantang

mjt262002@163.com

非常感谢




已经发过去了,收到回个话。
[/Quote]

已经收到。非常感谢
yjytiantang 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 softroad 的回复:]
引用 4 楼 yjytiantang 的回复:
我这有个源程序例子,发你邮箱过来,我传给你。



给我也来一个47478220@qq.com
[/Quote]


发送OK.
如一宝宝 2009-06-26
  • 打赏
  • 举报
回复
我也要,谢谢
fx_java@hotmail.com
yjytiantang 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 mawenyi1978 的回复:]
to:yjytiantang

mjt262002@163.com

非常感谢
[/Quote]



已经发过去了,收到回个话。
softroad 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yjytiantang 的回复:]
我这有个源程序例子,发你邮箱过来,我传给你。
[/Quote]

给我也来一个47478220@qq.com
changrong520lmd 2009-06-26
  • 打赏
  • 举报
回复
qwregfdgdfhbdfhbd
mawenyi1978 2009-06-26
  • 打赏
  • 举报
回复
to:yjytiantang

mjt262002@163.com

非常感谢
bigpretty 2009-06-26
  • 打赏
  • 举报
回复
帮忙定了,java的我有!
crazyhunter2008 2009-06-26
  • 打赏
  • 举报
回复
1233
yjytiantang 2009-06-26
  • 打赏
  • 举报
回复
我这有个源程序例子,发你邮箱过来,我传给你。
bdmh 2009-06-26
  • 打赏
  • 举报
回复
除了共享之外,估计你得在他人的机器上安排自己的间谍了
XD王 2009-06-26
  • 打赏
  • 举报
回复
这个有意思,hacker。。
xinxinshou2009 2009-06-26
  • 打赏
  • 举报
回复
友情帮顶
加油馒头 2009-06-26
  • 打赏
  • 举报
回复
具体代码如下,可以看懂的
//进入远程机器读取 文件
private void button2_Click(object sender, System.EventArgs e)
{
string ip= "172.17.3.70 ";
//open connection
string strRst1=ConnectOpen(ip);
//MessageBox.Show(strRst1.ToString());

//read txt
string s;
StreamReader srReadLine = new StreamReader(
(System.IO.Stream)File.OpenRead( "m:\\sql.txt "),// "Application.StartupPath.ToString().Trim()+ "\\Text.txt "),
System.Text.Encoding.Default);
srReadLine.BaseStream.Seek(0, SeekOrigin.Begin);
while(srReadLine.Peek() > -1)
{
s=srReadLine.ReadLine().Trim();
this.listBox1.Items.Add(s);
}
srReadLine.Close();

//close connection
string strRst2=ConnectClose(ip);

//MessageBox.Show(strRst2.ToString());


}

private string ConnectClose(string strIp)

{
p.StartInfo.FileName = "cmd.exe ";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;

string pingrst;
p.Start();
p.StandardInput.WriteLine( "net use \\172.17.3.77 /del ");
p.StandardInput.WriteLine( "exit ");
string strRst = p.StandardOutput.ReadToEnd();
pingrst = strRst;
p.Close();
return pingrst;

}

private string ConnectOpen(string strIp)

{
p.StartInfo.FileName = "cmd.exe ";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string pingrst;
p.Start();

//ping
p.StandardInput.WriteLine( "ping "+strIp);
p.StandardInput.WriteLine( "net use "+strIp+ " /user:uid pwd ");
p.StandardInput.WriteLine( "net use m: \\\\172.17.3.70\\share ");
p.StandardInput.WriteLine( "exit ");

string strRst = p.StandardOutput.ReadToEnd();

pingrst = strRst;
p.Close();
return pingrst;

}
加油馒头 2009-06-26
  • 打赏
  • 举报
回复
以流的方式读取:基本代码如下

StreamReader fileStream = new StreamReader("\\172.23.105.66\\I$\\love.txt", System.Text.Encoding.Default);,
66是我自己机器的IP,映射到\172.23.105.66\\I$\\love.txt


可以用 \\love\1\1.txt 这样的方式构造一个StreamReader,这样就可以了。

补充:不用Server.MapPath的,这是用于返回服务器的物理路径的,可你是要服务器访问客户机,所以不能用Server.MapPath。 直接 \\172.23.105.66\\D\\love.txt 就可以了.

加载更多回复(1)

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧