Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying files

Status
Not open for further replies.

safo2000

Programmer
Jul 9, 2002
46
LB
hi
you know how you use "copy *.jpeg c:\backup"

can u do that in a windows form?? is there a function for that???
thanks
 
Try something like the code below, which hasnt been tested, and may need a little work - but should give you an idea on how to do what you need

Dim objDir As IO.Directory
Dim objFile As IO.File
Dim strFile As String
For Each strFile In objDir.GetFiles("c:\myfolder")
If Mid(strFile, Len(strFile) - 4) = "jpeg" Then
objFile.Copy(strFile, "c:\backup\" + Mid(strFile, _
strFile.LastIndexOf("\") + 1))
End If
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top