Saving images from Raspberry Pi to a shared windows folder

I am running Raspbian OS on the current build (stretch). I need to be able to take a picture from a reliable camera and upload the image to a shared windows folder on my work network that has a domain controller. Right now I'm using a Logitech C910 USB webcam as a test. I can take a picture and save it to the Pi's local folders but don't know how to save directly to a shared windows folder. The commented line will save to the Pi just fine but the line that I'm trying to save to my windows folders isn't saving to the folder. Any help on how to get started and get this going would be great.

    import time
    import os
    #
    ### Take the picture using os.system to execute in terminal
    while True: # Always true
    print('before picture')
    os.system('fswebcam -r 960x720 smb://192.168.10.112/public/Tyler/Pics/%m-%d-%Y_%H:%M:%S.jpg')
    #os.system('fswebcam -r 1920x1080 /home/pi/Projects/camera/%m-%d-%Y_%H%M%S.jpg)
    print('after picture')
    time.sleep(30)
Tyler SinclairIT supervisorAsked:
Who is Participating?
 
Dr. KlahnConnect With a Mentor Principal Software EngineerCommented:
That's the way I would approach it.  You would probably want to confirm that the file exists on the remote machine before deleting it on the Pi if the information is irreplaceable.  Along those lines you might look into CurlFTPfs, which allows mounting a remote FTP folder as a local directory.

https://www.linuxquestions.org/questions/programming-9/sh-script-to-check-if-certain-files-exist-on-ftp-server-4175475868/
0
 
Dr. KlahnPrincipal Software EngineerCommented:
Is it a requirement that the files be transferred using an SMB shared drive?

It would be considerably simpler, imo, to use FTP and run a minimal FTP server such as BabyFTP or TinyFTP on the Windows system.  This would eliminate the need to support SMB / Samba on the Pi and free up a fair amount of memory.  The FTP client's incoming folder can still be shared among the Windows machines on the network.
0
 
Tyler SinclairIT supervisorAuthor Commented:
I will look into this as an option. Would the images being captured need to be saved to a local file on the RPi and then be uploaded via FTP? If that's the case I would just need to delete the file as it's being sent so I don't overrun the SD card.
0
 
Dr. KlahnPrincipal Software EngineerCommented:
Two solutions provided by sole commenter; points assigned.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.