• I found the problem. I had to put the drive letter in the path name. Like:

    \\servername\d$\foldername\filename.txt

    Thanks to everyone for taking the time to help me with this.