Clear Filters
Clear Filters

'The network path was not found' intermittent error only on VPN

15 views (last 30 days)
Hello, I have code that scrapes a database and saves data in seperate directories by station, year, and month.
Because I'm pulling data regularly, I have the following code to create a new directory if the directory doesn't yet exist.
if ~exist(stationfolderloc, 'dir');
mkdir(stationfolderloc);
end
stationfolderloc is formatted as '[servername]\[some sub directories]\[station_name]\[year]\[month]' with the station_name, year, and month updating based on the data being pulled.
This never fails when I have a wired ethernet connection to the office network (the directory is on a server on that network). However, when I am out of office and connecting via VPN I inconsistantly get the following error. (is red text)
Error using mkdir
The network path was not found.
Error in [Code_name] (line XXX)
mkdir(stationfolderloc);
However, I am able to navigate to the directory in windows explorer, and have no problem navigating to it in Matlab such that it can be the Current Folder. Using the exist function in Matlab gives an output of 7 (exists and is a directory). Using ~exist(stationfolderloc, 'dir') returns 0. So the 'IF' statement shouldn't even allow the code to get to the mkdir command.
I've setup monitoring for the VPN and confirmed the connection never drops when the error occurs. VPN is FortiClient, if that matters, I've been working with them to troubleshoot and they believe its a matlab issue.
  2 Comments
chrisw23
chrisw23 on 3 Apr 2024
It seems to be a security issue. Probably you are authenticated different via VPN. It may be a different group membership that prevents the creation of new folders. This is no Matlab issue.
You can try to map your root folder (ServerShare\...) and access the mapped drive by Matlab.
Chris Nygren
Chris Nygren on 3 Apr 2024
@chrisw23 Thank you for your suggestion. Alas, during troubleshooting I mapped/remapped the location where the error originated and confirmed I was able to access the location through the full path string and the mapped abreviation. I also confirmed I had permissions not only to access but to create directories, execute code, and delete files and directories at that location. I'll reach out to our network team to check on group membership nonetheless. If I find anything I'll update this comment.
Thanks again

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!