CodeItBetter Programming Another VB Programming Blog

How to move all the .png files from one folder to another.

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'File/Folder Handling - How to move all the .png files from one folder to another.
Private Sub Form_Load()
    MoveFiles "C:\test2\", "C:\test3\", "png"
End Sub
 
Private Sub MoveFiles(ByVal sSource As String, ByVal sDest As String, _
    Optional ByVal sExt As String = "*")
    Dim sFile As String
    If Not Right$(sSource, 1) = "\" Then sSource = sSource & "\"
    If Not Right$(sDest, 1) = "\" Then sDest = sDest & "\"
    sFile = Dir(sSource & "*." & sExt)
    Do While Len(sFile)
        Name sSource & sFile As sDest & sFile
        sFile = Dir
    Loop
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.