Please Help me
Any one know how can i copy a file to Root folder and all sub folder of Root folder:afrog:
only with one click of button
Printable View
Please Help me
Any one know how can i copy a file to Root folder and all sub folder of Root folder:afrog:
only with one click of button
vb Code:
Option Explicit Private Sub command1_Click() Dim sFolder() As String Dim sTmpFolder As String Dim sFile As String Dim sPath As String Dim i As Integer sPath = "C:\WINDOWS\Desktop\Test" sTmpFolder = Dir(sPath, vbDirectory) Do While sTmpFolder <> "" If sTmpFolder <> "." And sTmpFolder <> ".." Then If (GetAttr(sPath & sTmpFolder) And vbDirectory) = vbDirectory Then ReDim Preserve sFolder(0 To i) sFolder(i) = sTmpFolder & "\" i = i + 1 End If End If sTmpFolder = Dir Loop Do Until Dir(sPath) = "" sFile = Dir(sPath) Kill sPath & sFile Loop For i = 0 To UBound(sFolder) sTmpFolder = sPath & sFolder(i) Do Until Dir(sTmpFolder) = "" sFile = Dir(sTmpFolder) Kill sTmpFolder & sFile Loop Next Exit Sub End Sub
This is a function that will delete all the files in all the sub folder and root folder. I know it ain't what your searching for but it might give you an idea of what you are looking at here :) Sorry i couldn't be of more help i got to be somewhere cya.
Might be overkill for what you're doing, but the folder operations in the class from my signature handle subfolders during copy/move/delete operations.
ok thanks
it is not possible
How about the filesystem objectCode:Private Sub Command1_Click()
Dim fso As FileSystemObject
Set fso = New FileSystemObject
fso.CopyFolder "C:\images", "c:\temp\images"
Set fso = Nothing
End Sub