Button in Form to Move all .jpg images from one folder to another

  • Thread starter Thread starter The Boondock Saint
  • Start date Start date
T

The Boondock Saint

Does anyone know how I can have a button in a form to move all .jpg files
from one directory to another

Any help would be awesome.
 
Well, it will require VBA code, and will look something like this ...

Function MoveAllFiles() As Long

Dim strSourceDir As String
Dim strTargetDir As String
Dim strFile as string

strSourceDir = "C:\YaddaYadda\Images\"
strTargetDir = "D:\Storage\Yadda\Images\"

strfile = Dir(strSourceDir)

Do Until strFile = ""
If Right(strFile,4) = ".jpg" Then
FileCopy strSourceDir & strFile, strTargetDir & strFile
End If
Loop
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top