一个文件夹拷贝的实现(VB.net)
来源:互联网 发布:淘宝搞笑评价 编辑:程序博客网 时间:2024/05/18 03:05
' isOrNot 判断是否要拷贝
'fromFile 要拷贝的文件
'toPath 指定文件存放的位置
Private Function CopyFile(ByVal isOrNot As Boolean, ByVal fromFile As String, ByVal toPath As String)
If isOrNot = True Then
Dim strFolderName As String = fromFile.Substring(fromFile.LastIndexOf("/") + 1, fromFile.Length - fromFile.LastIndexOf("/") - 1)
If Not Directory.Exists(toPath & "/" & strFolderName) Then
Directory.CreateDirectory(toPath & "/" & strFolderName)
End If
Dim strFiles As String() = Directory.GetFiles(fromFile)
For i As Integer = 0 To strFiles.Length - 1
Dim fileName As String = strFiles(i).Substring(strFiles(i).LastIndexOf("/") + 1, strFiles(i).Length - strFiles(i).LastIndexOf("/") - 1)
File.Copy(strFiles(i), toPath & "/" & strFolderName & "/" & fileName, True)
Next
Dim dirInfo As DirectoryInfo = New DirectoryInfo(fromFile)
Dim ziPath As DirectoryInfo() = dirInfo.GetDirectories()
For j As Integer = 0 To ziPath.Length - 1
Dim strZiPath As String = fromFile & "/" & ziPath(j).ToString()
CopyFile(True, strZiPath, toPath & "/" & strFolderName)
Next
End If
End Function
第一次写技术性文章,有不对的地方希望大家来指正!谢谢!
- 一个文件夹拷贝的实现(VB.net)
- VB拷贝文件,拷贝文件夹
- 递归实现文件夹的拷贝
- java实现文件夹的拷贝
- 递归拷贝一个文件夹(java实现)
- VB.NET中用API实现打开文件夹
- 用java实现将许多文件夹下的所有.avi文件拷贝到一个文件夹
- java实现将一个文件夹的所有文件拷贝到另一个文件夹
- 拷贝文件夹到一个新的文件
- VB.net实现的一个简单的P2P示例
- VB.NET中监视文件夹的变化
- VB.NET中监视文件夹的变化
- VB.NET中监视文件夹的变化
- VB.NET中监视文件夹的变化
- VB.NET中监视文件夹的变化
- VB.NET中监视文件夹的变化
- vb.net机房收费系统一个小功能的实现
- Qt 实现的拷贝文件夹的函数
- 转:解决在验证码中的:getOutputStream() has already been called for this response异常错误
- 呼唤全新的傻瓜型操作系统
- Java栈与堆
- AAA
- linux环境下上网
- 一个文件夹拷贝的实现(VB.net)
- 从诺顿误杀联想WIN XP操作系统的后门--"误猜"微软窃取我国家机密?[转]
- 读取配置文件,简单代码
- Js代码收藏大全
- 在ACCESS中LIKE的用法
- InfoQ中文站好文阅读杂记#20070618 - "REAL OPTIONS"
- Ajax 中的高级请求和响应
- 使用异步Servlet扩展AJAX应用程序
- 2-Hibernate的各种关系映射