Ivan Velchev Ivan Velchev - 5 months ago 51
MySQL Question

Read data from shared file over network

I have some file in a shared folder on my network which contents I need to insert into a database.


Should I mount the file to my local directory and read it from there or I can extract the data from it and directly put it in the database with some php / perl script?

And if I choose the mounting approach, the issue is that the file is on a Windows OS not Linux?


You can just open it like normal:

open my $file, '<', '//xxx.xxx.xxx.xxx/SharedFolder/sample.txt' or die "Oops: $!";

I tested this and it worked for me on Windows.

When scripting you can (and should) use forward slashes in directory paths, even on Windows.