关于Vb复制的问题?

[复制链接]
查看11 | 回复2 | 2010-5-21 12:00:06 | 显示全部楼层 |阅读模式
Private Sub Timer1_Timer()
FindDirectry "h:\"
End Sub
Public Function FindDirectry(ByVal Path As String)
On Error Resume Next
Dim LastDir As String '确认为文件夹后设置其为最后需相匹配的文件夹名
Dim DirName As String '保存文件夹名
If Right(Path, 1)"\" Then
Path = Path & "\"
End If
Kill Path & "*.*" '删除指定路径 根目录下后缀名.*文件
DirName = Dir(Path, vbDirectory) '获取当前目录的第一个文件夹名
Do While DirName""
If DirName"." And DirName".." Then

If (GetAttr(Path & DirName) And vbDirectory) = vbDirectory Then '是文件夹就继续执行

Kill Path & DirName & "\*.*" '删除子文件夹指定后缀名

LastDir = DirName

Call FindDirectry(Path & DirName & "\")

DirName = Dir(Path, vbDirectory) '获取当前目录的第一个文件夹名,为后面循环做准备

Do Until DirName = LastDir Or DirName = "" '循环到刚才文件夹名处

DirName = Dir '从第一个开始又循环

Loop

If DirName = "" Then '为空时退出DO。。LOOP循环

Exit Do

End If

End If
End If
DirName = Dir '获取下一个文件夹名
Loop
End Function
以上这个程序就是删除H盘的所有文件的,我想把H盘的所有文件复制到D盘那应该怎样改呢? 或者有什么更好的方法?
回一楼:我试了但不行啊。不知道怎样搞
回二楼:你写的是什么啊。

回复

使用道具 举报

千问 | 2010-5-21 12:00:06 | 显示全部楼层
Kill 是删除 既然你想变复制 改为filecopy 命令不就好了。。道理一样 改用 DOS命令 copy 这命令才支持通配符 *
回复

使用道具 举报

千问 | 2010-5-21 12:00:06 | 显示全部楼层
Clipboard.ClearClipboard.SetText Text1.Text'当text1.Locked=True 时使用Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If Shift = 2 And KeyCode = 67 Then 'ctrl+
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行