iknowu99
Well-known Member
- Joined
- Dec 26, 2004
- Messages
- 1,158
So far I have the following and it works:
Thanks to Ivan the terrible.
when a cd is inserted the drive's name changes. How does one get the cd name?
Code:
Sub mCopyDir()
Dim oFso As Object
Dim sDestDir As String
Const OverWriteFiles = True
'// Copies All files to this Folder
sDestDir = "C:\ATesting\"
'MkDir sDestDir
Set oFso = CreateObject("Scripting.FileSystemObject")
TryAgain:
On Error GoTo FsoErr:
'// Note this Overwrite existing files unless set to false!
'// Fso.CopyFolder "C:\AData\", "C:\AATmp\",False
oFso.CopyFolder "D:\*.*", sDestDir, OverWriteFiles
Exit Sub
FsoErr:
If Err.Number = 76 Then
MkDir sDestDir
Err.Clear
Resume TryAgain
Else
MsgBox "Err#:=" & Err.Number & vbCr & _
"Descrp:=" & Err.Description, _
vbMsgBoxHelpButton, _
"FileSystemObject Error", _
Err.HelpFile, _
Err.HelpContext
End If
End Sub
Thanks to Ivan the terrible.
when a cd is inserted the drive's name changes. How does one get the cd name?