bom noite a todos eu preciso de uma ajuda de vcs, eu precisso fazer um programinha que faz copy de um pasta e sub pasta e todos os arquivo. e que eu fazo coletania de jogos em cd, e ele rada direto no cd, fazer um programinha que copy a pasta e sub pasta e todos os arquivos para "HD" peguei uma Project aqui no vbweb só que ele só copy 1 "UM" arquivo.
exp
'************************************************************************
'Coded by : Nabhan Ahmed
'Date : 8-25-2003
'Description: This program shows you how to copy a file byte by byte.
' It reads 4 kbs from the source file and write them in
' the destination file until it reads all byte in the source
' file. There a bar that shows the copying progress.
'*************************************************************************
Private Sub CmdBrowse_Click()
'Set filter to all files
CmnDlg.Filter = "All files|*.*"
'Show the open file window
CmnDlg.ShowOpen
'Put the file bath in the source text
TxtSrc.Text = CmnDlg.FileName
End Sub
Private Sub CmdCopy_Click()
On Error GoTo CopyErr
'Declare variables
Dim SrcFile As String
Dim DestFile As String
Dim SrcFileLen As Long
Dim nSF, nDF As Integer
Dim Chunk As String
Dim BytesToGet As Integer
Dim BytesCopied As Long
'Disable the copy button
CmdCopy.Enabled = False
'The source file the you want to copy
SrcFile = TxtSrc
'The destination file name
DestFile = TxtDest
'Get source file length
SrcFileLen = FileLen(SrcFile)
'Progress bar settings
ProgressBar1.Min = 0
ProgressBar1.Max = SrcFileLen
'Open both files
nSF = 1
nDF = 2
Open SrcFile For Binary As nSF
Open DestFile For Binary As nDF
'How many bytes to get each time
BytesToGet = 4096 '4kb
BytesCopied = 0
'Show Progress
ProgressBar1.Value = 0
'Show percentage
LblPercent.Caption = "0"
'ProgressBar1.Visible = True
'Keep copying until finishing all bytes
Do While BytesCopied < SrcFileLen
'Check how many bytes left
If BytesToGet < (SrcFileLen - BytesCopied) Then
'Copy 4 KBytes
Chunk = Space(BytesToGet)
Get #nSF, , Chunk
Else
'Copy the rest
Chunk = Space(SrcFileLen - BytesCopied)
Get #nSF, , Chunk
End If
BytesCopied = BytesCopied + Len(Chunk)
'Show progress
ProgressBar1.Value = BytesCopied
'Show Percentage
LblPercent.Caption = Int(BytesCopied / SrcFileLen * 100)
LblPercent.Refresh
'Put data in destination file
Put #nDF, , Chunk
Loop
'Hide progress bar
ProgressBar1.Value = 0
'ProgressBar1.Visible = False
'Skip the error message and exit sub
GoTo Ex
CopyErr:
MsgBox Err.Description, vbCritical, "Error"
Ex:
'Close files
Close #nSF
Close #nDF
'Re-enable the copy button
CmdCopy.Enabled = True
End Sub