I am using VB5. I know how to use Dir and FSO to check if a file exists on my computer, but how do you check if a file exists on a "Network" computer?? I've checked Google but can't find an answer.
Thanks for your help.
Printable View
I am using VB5. I know how to use Dir and FSO to check if a file exists on my computer, but how do you check if a file exists on a "Network" computer?? I've checked Google but can't find an answer.
Thanks for your help.
Need to log in, first. NET USE /? will show the commands needed.
I am using VB5.
I don't understand your post????
You check on the network in the same fashion as you would locally. You must either be logged in on your system with a user ID and password that is valid on the target computer or you must have connected to it with a userid and password that grants access.
If it is a mapped drive then you can just use the mapped drive letter just like you would for yoru local drive. If it is not mapped then you would need to use a UNC path as in \\PCName\DriveName\path\file
The documentation for "Dir" says file string you search for must begin with either a letter or number!
That's the reason "\\Server\File Folder\Myfile.txt" doesn't work for me using Dir and I assume why it doesn't work for me using FSO.
I'm still stumped!!
NET USE /? BEFORE your type a drive letter. MAP the drive, first.....
Dir() works fine with UNC path names as long as you have access to the drive. If you would have to provide a different user id and/or password then you may run into issues unless you connect to the drive first via Net Use or other option.
This code returns the first zip file in the archive folder of my server under VB6. I assume it will work under VB5 but can't say for sure. If not then you need to ditch VB5 and move to something newer. Most of us quit using VB5 over 10 years ago.
Code:MsgBox Dir("\\Ultra-955\Raid-mirror\archives\*.zip")
Make sure you do have access to the server
Click on Start
Click on Run
key \\Server - PRESS ENTER
Do You see the server directory ?
Is the Folder you want Shared ?
Did it ask for User Name and Password ? (This is probably your problem)
- supply this and Dir will work
That doesn't help the VB6 issue, George
What VB6 Issue?
VB6 Dir() function works fine with UNC or mapped paths. If you have connected to the drive with Net Use or other method already then there should be no issue.
I don't think he has a VB6 issue (yet ...)
I think he's not getting to first base - connecting to the server