pcalabria
asked on
Need to copy and delete photos from a removable storage device to the local hard drive in MS Access
From inside MS Access 365 (win10) I need to pro grammatically copy the photos from a D60 Nikon camera to a folder on my local hard drive then delete the photos in the camera.
The camera folder shows up in file explorer as:
This "PC\D60\Removable storage\DCIM\MyPhotos\"
I would think I should be able to do this with FileCopy but it does not seem to recognize the path.
Can anyone help. I need to copy everything from
"This PC\D60\Removable storage\DCIM\MyPhotos\
to c:\myfolder\ then delete everything in "This PC\D60\Removable storage\DCIM\MyPhotos\"
The camera folder shows up in file explorer as:
This "PC\D60\Removable storage\DCIM\MyPhotos\"
I would think I should be able to do this with FileCopy but it does not seem to recognize the path.
Can anyone help. I need to copy everything from
"This PC\D60\Removable storage\DCIM\MyPhotos\
to c:\myfolder\ then delete everything in "This PC\D60\Removable storage\DCIM\MyPhotos\"
You need to take out the SD card from your camera and put the SD card in a USB card reader and you can just input the path name as X:\DCIM\MyPhotos\ where X: is the drive letter name of your SD card.
ASKER
@Jackie Man -- Thanks, but that's not an option for us. We need to take tens of thousands of photos and log each of them to a database.
Up until now, we have been opening file explorer and copying the images with the camera still attached, however, doing so (1) does not allow us to delete the images, and (2) is prone to errors. Operators forget to copy them, and copy them the wrong place,
As File Explorer can see the images, and we can copy them, I would think we should be able to programmatically copy them too???
Up until now, we have been opening file explorer and copying the images with the camera still attached, however, doing so (1) does not allow us to delete the images, and (2) is prone to errors. Operators forget to copy them, and copy them the wrong place,
As File Explorer can see the images, and we can copy them, I would think we should be able to programmatically copy them too???
For probably all the ways to get a list of files inside a folder you should check here : https://software-solutions-online.com/list-files-and-folders-in-a-directory/
And for copy-move : https://www.rondebruin.nl/win/s3/win026.htm
And for copy-move : https://www.rondebruin.nl/win/s3/win026.htm
As File Explorer can see the images, and we can copy them, I would think we should be able to programmatically copy them too???
No. If you directly connect your camera via USB, the camera will be regarded as a MTP device and you cannot use any programming for Windows OS to do read / write for the data inside a MTP device.
https://superuser.com/questions/369959/how-do-i-access-mtp-devices-on-the-command-line-in-windows II
No. If you directly connect your camera via USB, the camera will be regarded as a MTP device and you cannot use any programming for Windows OS to do read / write for the data inside a MTP device.
https://superuser.com/questions/369959/how-do-i-access-mtp-devices-on-the-command-line-in-windows II
<<No. If you directly connect your camera via USB, the camera will be regarded as a MTP device and you cannot use any programming for Windows OS to do read / write for the data inside a MTP device. >>
You can change the device type to MSC to use file explorer and with WIA, you can read a camera and move/delete files with it set as MTP. I tripped over that trying to do something else for pcalabria yesterday. I was trying to figure out how to take a snapshot with a web cam and was able to fetch a picture off my phone. I don't know it's a total solution though for the question at hand as that wasn't what I was looking for. Just noted it for future reference.
Jim.
You can change the device type to MSC to use file explorer and with WIA, you can read a camera and move/delete files with it set as MTP. I tripped over that trying to do something else for pcalabria yesterday. I was trying to figure out how to take a snapshot with a web cam and was able to fetch a picture off my phone. I don't know it's a total solution though for the question at hand as that wasn't what I was looking for. Just noted it for future reference.
Jim.
@Jim D: Jim, do you remember where you saw that at? I've got a client who would love to do that and others have told him he can't, but if I can, WOOOO HOOOOO!
Do you know if it works for phones, too?
Name your price$$$$$$.
Do you know if it works for phones, too?
Name your price$$$$$$.
I am pretty sure that you cannot change the device type to MSC for an MTP device (like smartphones).
@Mark,
<<@Jim D: Jim, do you remember where you saw that at? I've got a client who would love to do that and others have told him he can't, but if I can, WOOOO HOOOOO! >>
I'll see if I can find it again.
@Jackie,
<<I am pretty sure that you cannot change the device type to MSC for an MTP device (like smartphones). >>
I've heard some phones do not, but some like my iPhone do.
Jim.
<<@Jim D: Jim, do you remember where you saw that at? I've got a client who would love to do that and others have told him he can't, but if I can, WOOOO HOOOOO! >>
I'll see if I can find it again.
@Jackie,
<<I am pretty sure that you cannot change the device type to MSC for an MTP device (like smartphones). >>
I've heard some phones do not, but some like my iPhone do.
Jim.
@Jim
You can assign a drive letter for your iPhone if you connect it to your computer with the bundled USB lighting cable?
I would like to learn how to do it.
You can assign a drive letter for your iPhone if you connect it to your computer with the bundled USB lighting cable?
I would like to learn how to do it.
ASKER
So what is the verdict?
Can I copy photos from the removable device directory created when I plug it into a USB port, or do I need to open file explorer and drag and drop them.... which by the way.. lets me copy but not delete them.
Thanks
p
Can I copy photos from the removable device directory created when I plug it into a USB port, or do I need to open file explorer and drag and drop them.... which by the way.. lets me copy but not delete them.
Thanks
p
Not sure. As I mentioned, I was able to copy a file from my phone the other day when I was working with the WIA code. I did not try and delete it however at the time. I was looking for a solution for you on capturing an image and just thought "that's interesting" and moved on.
I also need to explore the MSC/MTP issue and get Jackie an answer. I thought I had done that on my phone (switched the mode), but I may be remembering an older phone as it doesn't look like newer iPhones can switch modes. Right now, my iPhone presents itself in file explorer without a drive letter, but I can work with the files and delete them. That apparently is done through a USB driver for the phone.
Which brings us back to the whole issue of WIA vs WPD, the later of which I believe is the answer to all of this (both capture and working with images).
But I haven't been able to get back to any of this. I'll try and get to this a little later today, but no promises. It's been a busy day so far.
Jim.
I also need to explore the MSC/MTP issue and get Jackie an answer. I thought I had done that on my phone (switched the mode), but I may be remembering an older phone as it doesn't look like newer iPhones can switch modes. Right now, my iPhone presents itself in file explorer without a drive letter, but I can work with the files and delete them. That apparently is done through a USB driver for the phone.
Which brings us back to the whole issue of WIA vs WPD, the later of which I believe is the answer to all of this (both capture and working with images).
But I haven't been able to get back to any of this. I'll try and get to this a little later today, but no promises. It's been a busy day so far.
Jim.
ASKER
Does anyone else have any ideas?
Thanks
Thanks
So lets take it from the start.
It would be helpful to show some screenshots of your current situation and if you have tried anything in code level.
Is it exactly the same as connecting a phone ? i am afraid i haven't ever worked this case...but it would be interesting as a challenge... :)
It would be helpful to show some screenshots of your current situation and if you have tried anything in code level.
Is it exactly the same as connecting a phone ? i am afraid i haven't ever worked this case...but it would be interesting as a challenge... :)
Something else also...Nikon has a SDK/API...i haven't downloaded but maybe it would helpful.
Question...if we could use WPD via Access would that solve the case? is it the same as connecting phones...
I am afraid 2 digital cameras i had are long gone...my daughter took care of them.. :) so i cannot do any testing...
I am afraid 2 digital cameras i had are long gone...my daughter took care of them.. :) so i cannot do any testing...
Going back to the other question you asked about image capture when I was exploring WIA for taking a picture, one of the things that fell out of that was the ability to move photos from my camera storage device. I still have the test DB I was playing around with and will post it.
And certainly WPD as John mentioned is worth looking at. It is the replacement lib for WIA and should be able to handle both tasks.
Jim
And certainly WPD as John mentioned is worth looking at. It is the replacement lib for WIA and should be able to handle both tasks.
Jim
So I looked around and it doesn't look like I saved the early work I did with WIA (I was focused on trying to take a picture), but I know I connected to my phone and copied a file to my PC. It didn't take long to get to that point either.
Also, the sample DB for dbPix does exactly this (along with taking the photo if the camera has a WIA driver), so it's certainly doable with WIA. The code for moving and deleting files is right there.
Also, the sample DB for dbPix does exactly this (along with taking the photo if the camera has a WIA driver), so it's certainly doable with WIA. The code for moving and deleting files is right there.
and I don't see any copyright notice on that dbPix sample code, so:
Dim WIA_Device As Object ' WIA.Device
Dim DeviceID As String
Dim colRetrievedItemIdList As New Collection ' List of retrieved item Id's for deletion
Dim ListItem As Variant
Dim strListItem As String
DeviceID = cboCameras
On Error GoTo Err_Handler
Set WIA_Device = WIA_DeviceMgr.DeviceInfos(DeviceID).Connect ' Connect to device
If (WIA_Device Is Nothing) Then GoTo Exit_Here
RetrieveAllItems WIA_Device.items, colRetrievedItemIdList ' Retrieve all items and store Id's
If chkDeleteFromCamera Then ' Delete checkbox checked - try to delete the images from the camera
For Each ListItem In colRetrievedItemIdList
strListItem = ListItem
DeleteItem WIA_Device.items, strListItem
Next
End If
Exit_Here:
Set WIA_Device = Nothing
Set colRetrievedItemIdList = Nothing
Exit Sub
Err_Handler:
MsgBox Err.Description, vbOKOnly + vbCritical, "Error Retrieving Pictures"
Resume Exit_Here
That should get you going with this if you take the WIA route.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.