cristofayre has asked for the wisdom of the Perl Monks concerning the following question:

This is what I am trying to achieve. On machineA, there is a folder where images are constantly updated. On machineB, Apache and Perl are running (Windows - maybe Unix). Both are connected via a network, either LAN cable for reliability, or PERHAPS wifi (see below) The idea is that people can log into machineB via wi-fi, and download the photos direct to their phone. (Doing a test with Apache currently running on test machineA, I have found that a phone can log into server using 192.168.0.2, and it displays files in Apache/htdocs. Presumably, to access a script would be 192.168.0.2/cgi-bin/name_of_script ... or a redirect in index.html that takes them to script, or a Rewrite recipe)

Why not run Apache / Perl on host machine? The part that controls the DSLR camera, creates the photos ready for printing etc already needs a fast CPU, such as an i3. To add further processing requirements or dozens of people accessing folders via Wi-fi, it would slow the host machine. Better to spend a few seconds copying each photo as taken to another machine, and let that do the 'donkey work' of displaying / sending pics (That said, I may need machineB to be Unix so it can run several threads for each person accessing the script at the same time)

THIS IS THE QUESTION: The "tricky" part is getting the files from A to B. Am I correct in =THINKING= it would be a simple copy command, with a folder on machineB having a drive letter not used on MachineA (ie "copy C:/xxx to M:/xxx" This could be a simple perl infinate While() loop on machineA that checks the folder every 10 secs, and then initiates the copy if things have changed) Again, I'm thinking the LAN networked machines act as one large PC. Or have I got to connect to machineB via the IP address? I know machineA has a 127.0.0.1 IP localhost / windows host file which runs virtual hosts as development machine

The drive letter approach MAY present a problem. I have multiple partitions on MachineA (C:/, E:/emails, P:/photos, M:/music, G:/extract, O:/ebay, D:/localhost files etc, the idea being if one partition fails,I will not lose the entire contents on the disc) Add in four drive letter assigned to the 4 in 1 card reader ... and virtually all of the A-Z drive letters have been assigned !! Any way around that? (I don't think WIndows will accept double digit drive letters such as "AB", "AC" etc

Replies are listed 'Best First'.
Re: Copy files around network
by Corion (Pope) on Oct 24, 2019 at 09:06 UTC

    If the connection is unreliable, you can maybe use rsync (see also Rsync) to transfer the files to machineB.

    If you want a low latency approach, consider pushing the files from machineA to machineB, starting rsync whenever a new file arrives using Filesys::Notify::Simple (and Win32::ChangeNotify).

Re: Copy files around network (OT)
by hippo (Chancellor) on Oct 24, 2019 at 09:04 UTC
    On machineA, there is a folder where images are constantly updated.

    It sounds like this might be the crux of the problem. Why not have this "folder" on MachineB instead? Then MachineA could remote-mount this via sshfs or similar and the image capture procedure can carry on, wilfully ignorant that it's really writing to MachineB. Does this solve the problem for you?

Re: Copy files around network
by cristofayre (Sexton) on Oct 24, 2019 at 08:47 UTC
    I've just re-read this, and it's more a network "problem" rather than perl,so understand if Admin wish to delete.