怎么将文件夹里指定的图片,复制到另一个文件夹中!急!急

tjava_net 2010-11-20 02:32:17
怎么将文件夹里指定的图片,复制到另一个文件夹中
...全文
1881 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
changebubu 2010-11-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 q107770540 的回复:]
http://msdn.microsoft.com/zh-cn/library/9706cfs5(v=VS.80).aspx
[/Quote]
Imports System
Imports System.IO

Public Class Test
Public Shared Sub Main()
' Specify the directories you want to manipulate.
Dim path As String = "c:\temp\MyTest.txt"
Dim path2 As String = path + "temp"

Try
Dim fs As FileStream = File.Create(path)
fs.Close()

' Ensure that the target does not exist.
File.Delete(path2)

' Copy the file.
File.Copy(path, path2)
Console.WriteLine("{0} copied to {1}", path, path2)

' Try to copy the same file again, which should succeed.
File.Copy(path, path2, True)
Console.WriteLine("The second Copy operation succeeded, which was expected.")

Catch
Console.WriteLine("Double copying is not allowed, which was not expected.")
End Try
End Sub
End Class
peng2739956 2010-11-20
  • 打赏
  • 举报
回复
copy to...流的基本属性方法 LZ得多看看书。。
yxf522 2010-11-20
  • 打赏
  • 举报
回复
用copy to
天煞19 2010-11-20
  • 打赏
  • 举报
回复
直接调用用copy()函数啊
Qcontriver 2010-11-20
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 q107770540 的回复:]
File.Copy(要复制的文件, 目标文件的名称。不能是目录, true);

如:
File.Copy(@"c:\a.jpg", @"d:\b.jpg", true);
[/Quote]
试过,正确无误。
q107770540 2010-11-20
  • 打赏
  • 举报
回复
File.Copy(要复制的文件, 目标文件的名称。不能是目录, true);

如:
File.Copy(@"c:\a.jpg", @"d:\b.jpg", true);

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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