Link to home
Start Free TrialLog in
Avatar of ELPANOS
ELPANOS

asked on

MS ACCESSS select all the jpg files and then copy and paste

Good morning,
I work in acces 2007 i have one form and i have make one Botton , then i want to select all the jpg files from one folder and copy with the same name to anather folder.
Thks For your help
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Sub fc()
Dim SourceFile, DestinationFile
SourceFile = "C:\oldfolder\*.jpg"    ' Define source folder and files.
DestinationFile = "C:\newfolder\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "


End Sub
Avatar of ELPANOS
ELPANOS

ASKER

Thks for your answer,
i have make the code but nothing is hapen

Private Sub TRANSFERFOTO_Click()
Dim SourceFile, DestinationFile
SourceFile = "\\Panorama-server\data (f)\PHOTOS\Update catalog êùäéêïðïéçóç\*.jpg"    ' Define source folder and files.
DestinationFile = "D:\FOTOCODE\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "
End Sub

Private Sub TRANSFERFOTO_Click()
Dim SourceFile, DestinationFile
SourceFile = "\\Panorama-server\data (f)\PHOTOS\Update catalog êùäéêïðïéçóç\*.jpg"    ' Define source folder and files.
DestinationFile = "D:\FOTOCODE\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ELPANOS

ASKER

Thks For your help i find finalist this code and is worck, i give you for referance

Private Sub transferfoto_Click()
Dim fso
Dim sfol As String, dfol As String
sfol = "\\Panorama-server\data (f)\PHOTOS\Update catalog" ' change to match the source folder path
dfol = "D:\FOTOCODE" ' change to match the destination folder path
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If Not fso.FolderExists(sfol) Then
    MsgBox sfol & " is not a valid folder/path.", vbInformation, "Invalid Source"
ElseIf Not fso.FolderExists(dfol) Then
    MsgBox dfol & " is not a valid folder/path.", vbInformation, "Invalid Destination"
Else
    
    fso.CopyFile (sfol & "\*.*"), dfol ' Change "\*.*" to "\*.xls" to move Excel Files only
End If
If Err.Number = 53 Then MsgBox "File not found"
End Sub

Open in new window

The source path in your 'working' code is not the same as the source path you used in the 'not-working' code you posted earlkier.

Avatar of ELPANOS

ASKER

Peter i need also progressBar the time is transfer the fotos you can help me?
please post a new question so that more people see it.