How to Copy an Entire Directory in VB6?
2005-08-27 00:35
661 查看
Sub Copy(ByVal SourcePath As String, ByVal DestinationPath As String)
'拷贝指定目录下所有文件到另一位置
'by VBDN 2005-8-26 http://blog.csdn.net/vbdn/
'注意:SourcePath,DestinationPath这两个目录一定要存在,否则会出错
'使用举例: Copy "c:/temp", "c:/a" 将会把目录c:/temp下所有文件拷贝到c:/a下
Dim sFile As String
SourcePath = Replace(SourcePath & "/", "//", "/")
DestinationPath = Replace(DestinationPath & "/", "//", "/")
sFile = Dir(SourcePath, vbNormal Or vbHidden Or vbArchive Or vbReadOnly)
Do While Len(sFile) > 0
Debug.Print SourcePath & sFile, DestinationPath & sFile
FileCopy SourcePath & sFile, DestinationPath & sFile
sFile = Dir '下一个文件
Loop
End Sub
'拷贝指定目录下所有文件到另一位置
'by VBDN 2005-8-26 http://blog.csdn.net/vbdn/
'注意:SourcePath,DestinationPath这两个目录一定要存在,否则会出错
'使用举例: Copy "c:/temp", "c:/a" 将会把目录c:/temp下所有文件拷贝到c:/a下
Dim sFile As String
SourcePath = Replace(SourcePath & "/", "//", "/")
DestinationPath = Replace(DestinationPath & "/", "//", "/")
sFile = Dir(SourcePath, vbNormal Or vbHidden Or vbArchive Or vbReadOnly)
Do While Len(sFile) > 0
Debug.Print SourcePath & sFile, DestinationPath & sFile
FileCopy SourcePath & sFile, DestinationPath & sFile
sFile = Dir '下一个文件
Loop
End Sub
相关文章推荐
- git tip: How to undo an uncommitted change/deletion for a specific file in your working directory
- How to copy an object in objective c
- How do you copy the contents of an array to a std::vector in C++ without looping? (From stack over flow)
- MSMQ&Com+ Service: How to create an Com+ Service in .NetFramework
- How to store an image file to SQliteDB in android
- how to make a authorware file in an environment without authorware
- How to use Oracle 11g ODP.NET UDT in an Oracle Stored Procedure's Where clause
- How to restore an element that has been deleted in CCRC?
- how to count files in directory
- How To Create a Child Domain in Active Directory and Delegate the DNS Namespace to the Child Domain
- how to restrict copy paste in a Textbox, in MFC?
- How to create an Excel sheet or chart in VC?
- 码农如何快速打造一个有设计感的网站 How to Make Your Site Look Half-Decent in Half an Hour
- How to fix Rosetta stone error 2123 -- "This was an error in the application"
- How to Manually Determining and Resolving Archive Gaps in ASM (Copy archivelog in ASM using RMAN) [I
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- How To Customise the Tab Bar (UITabBar) in an iPhone Application (Part 2 of 2)
- An example to show how to make Tree structure data table in SQL server
- How to Make An Uimage(In YOCTO,RDK)?
- How To Create Directory In Java--创建单个目录,多个目录(子目录)