I shared a folder on my server using Windows sharing. On another computer, where I run my code, I mapped a network drive pointing to this folder.
In my code, I periodically transfer files from the local computer to my server. Something like that:
File srcFile = new File("C:\\test.mpg"); File destFile = new File(...);
For destFile , which approach should I use? My current approach:
File destFile = new File("Z:\\folder\\test.mpg");
or using the network path:
File destFile = new File("\\192.168.123.123\\folder\\test.mpg");
I ask about this because recently I came across cases where the file transfer failed, because my program cannot write to my network drive, because it was not logged in, and I need to manually go to the drive and enter my credentials data and enable "Stay Connected."
source share