Author |
Message |
RB Smissaer #1 / 12
|
 How to check for this file path?
How do I check if a file exists if the filepath is given like this: servername:serverdrive:\folder\file where server drive is the local drive name, so usually C RBS
|
Thu, 17 Feb 2011 04:00:57 GMT |
|
 |
Steve Easto #2 / 12
|
 How to check for this file path?
From MSDN. The following procedure returns true if the specified file exists and false if it does not, but doesn't contain error-handling code: Function FileExists (filename) As Boolean FileExists = (Dir(filename) <> "") End Function -- Steve Easton Quote:
> How do I check if a file exists if the filepath is given like this: > servername:serverdrive:\folder\file > where server drive is the local drive name, so usually C > RBS
|
Thu, 17 Feb 2011 04:57:26 GMT |
|
 |
RB Smissaer #3 / 12
|
 How to check for this file path?
But that will give False or an error with that kind of file path. I have also tried these 2: Private Declare Function PathFileExists Lib "shlwapi" _ Alias "PathFileExistsA" _ (ByVal pszPath As String) As Long Function bFileExists2(sFile As String) As Boolean bFileExists2 = PathFileExists(sFile) = 1 End Function Function bFileExists(ByVal sFile As String) As Boolean Dim lAttr As Long On Error Resume Next lAttr = GetAttr(sFile) bFileExists = (Err.Number = 0) And ((lAttr And vbDirectory) = 0) On Error GoTo 0 End Function But they will give False as well with that type of path. RBS
Quote: > From MSDN. > The following procedure returns true if the specified file exists and > false if it does not, but doesn't contain error-handling code: > Function FileExists (filename) As Boolean > FileExists = (Dir(filename) <> "") > End Function > -- > Steve Easton
>> How do I check if a file exists if the filepath is given like this: >> servername:serverdrive:\folder\file >> where server drive is the local drive name, so usually C >> RBS
|
Thu, 17 Feb 2011 05:15:13 GMT |
|
 |
Hennin #4 / 12
|
 How to check for this file path?
Shouldn't the path be given as \\servername\serverdrive\folder\file ? /Henning
Quote: > From MSDN. > The following procedure returns true if the specified file exists and > false if it does not, but doesn't contain error-handling code: > Function FileExists (filename) As Boolean > FileExists = (Dir(filename) <> "") > End Function > -- > Steve Easton
>> How do I check if a file exists if the filepath is given like this: >> servername:serverdrive:\folder\file >> where server drive is the local drive name, so usually C >> RBS
|
Thu, 17 Feb 2011 07:03:08 GMT |
|
 |
RB Smissaer #5 / 12
|
 How to check for this file path?
That is the path I have to deal with and it does work as I can use it in a .bat file and no error occurs. In any case it will give False even with the \\servername\serverdrive\folder\file path. RBS
Quote: > Shouldn't the path be given as \\servername\serverdrive\folder\file ? > /Henning
>> From MSDN. >> The following procedure returns true if the specified file exists and >> false if it does not, but doesn't contain error-handling code: >> Function FileExists (filename) As Boolean >> FileExists = (Dir(filename) <> "") >> End Function >> -- >> Steve Easton
>>> How do I check if a file exists if the filepath is given like this: >>> servername:serverdrive:\folder\file >>> where server drive is the local drive name, so usually C >>> RBS
|
Thu, 17 Feb 2011 07:11:23 GMT |
|
 |
Bob Butle #6 / 12
|
 How to check for this file path?
Quote: > That is the path I have to deal with and it does work as I can use it in a > .bat file and no error occurs. > In any case it will give False even with the > \\servername\serverdrive\folder\file path.
try \\servername\serverdrive$\folderpath\filename note the $ you will need administrative rights to the target machine for that to work
|
Thu, 17 Feb 2011 07:20:17 GMT |
|
 |
Hennin #7 / 12
|
 How to check for this file path?
Also beware that serverdrive has no colon(:) /Henning
Quote: > That is the path I have to deal with and it does work as I can use it in a > .bat file and no error occurs. > In any case it will give False even with the > \\servername\serverdrive\folder\file path. > RBS
>> Shouldn't the path be given as \\servername\serverdrive\folder\file ? >> /Henning
>>> From MSDN. >>> The following procedure returns true if the specified file exists and >>> false if it does not, but doesn't contain error-handling code: >>> Function FileExists (filename) As Boolean >>> FileExists = (Dir(filename) <> "") >>> End Function >>> -- >>> Steve Easton
>>>> How do I check if a file exists if the filepath is given like this: >>>> servername:serverdrive:\folder\file >>>> where server drive is the local drive name, so usually C >>>> RBS
|
Thu, 17 Feb 2011 07:39:01 GMT |
|
 |
RB Smissaer #8 / 12
|
 How to check for this file path?
Thanks for the suggestions, but I can't get it to work when I have the server name in the path. Will do some further Googling. RBS
Quote: > Also beware that serverdrive has no colon(:) > /Henning
>> That is the path I have to deal with and it does work as I can use it in >> a .bat file and no error occurs. >> In any case it will give False even with the >> \\servername\serverdrive\folder\file path. >> RBS
>>> Shouldn't the path be given as \\servername\serverdrive\folder\file ? >>> /Henning
>>>> From MSDN. >>>> The following procedure returns true if the specified file exists and >>>> false if it does not, but doesn't contain error-handling code: >>>> Function FileExists (filename) As Boolean >>>> FileExists = (Dir(filename) <> "") >>>> End Function >>>> -- >>>> Steve Easton
>>>>> How do I check if a file exists if the filepath is given like this: >>>>> servername:serverdrive:\folder\file >>>>> where server drive is the local drive name, so usually C >>>>> RBS
|
Thu, 17 Feb 2011 17:02:48 GMT |
|
 |
Hennin #9 / 12
|
 How to check for this file path?
Asking the obvious, but have you the exact path it in a command promt? /Henning
Quote: > Thanks for the suggestions, but I can't get it to work when I have the > server name in the path. > Will do some further Googling. > RBS
>> Also beware that serverdrive has no colon(:) >> /Henning
>>> That is the path I have to deal with and it does work as I can use it in >>> a .bat file and no error occurs. >>> In any case it will give False even with the >>> \\servername\serverdrive\folder\file path. >>> RBS
>>>> Shouldn't the path be given as \\servername\serverdrive\folder\file ? >>>> /Henning
>>>>> From MSDN. >>>>> The following procedure returns true if the specified file exists and >>>>> false if it does not, but doesn't contain error-handling code: >>>>> Function FileExists (filename) As Boolean >>>>> FileExists = (Dir(filename) <> "") >>>>> End Function >>>>> -- >>>>> Steve Easton
>>>>>> How do I check if a file exists if the filepath is given like this: >>>>>> servername:serverdrive:\folder\file >>>>>> where server drive is the local drive name, so usually C >>>>>> RBS
|
Thu, 17 Feb 2011 19:23:11 GMT |
|
 |
RB Smissaer #10 / 12
|
 How to check for this file path?
Yes, have checked several times. Probably I am overlooking something simple somewhere. RBS
Quote: > Asking the obvious, but have you the exact path it in a command promt? > /Henning
>> Thanks for the suggestions, but I can't get it to work when I have the >> server name in the path. >> Will do some further Googling. >> RBS
>>> Also beware that serverdrive has no colon(:) >>> /Henning
>>>> That is the path I have to deal with and it does work as I can use it >>>> in a .bat file and no error occurs. >>>> In any case it will give False even with the >>>> \\servername\serverdrive\folder\file path. >>>> RBS
>>>>> Shouldn't the path be given as \\servername\serverdrive\folder\file ? >>>>> /Henning
>>>>>> From MSDN. >>>>>> The following procedure returns true if the specified file exists and >>>>>> false if it does not, but doesn't contain error-handling code: >>>>>> Function FileExists (filename) As Boolean >>>>>> FileExists = (Dir(filename) <> "") >>>>>> End Function >>>>>> -- >>>>>> Steve Easton
>>>>>>> How do I check if a file exists if the filepath is given like this: >>>>>>> servername:serverdrive:\folder\file >>>>>>> where server drive is the local drive name, so usually C >>>>>>> RBS
|
Thu, 17 Feb 2011 19:40:19 GMT |
|
 |
Ralp #11 / 12
|
 How to check for this file path?
Quote: > Yes, have checked several times. > Probably I am overlooking something simple somewhere. > RBS
It has been my experience that support for UNC is inconsistent across platforms, libraries, and configurations (permissions, share, AD, etc). You will find the web littered with work-arounds for resolving the location for specific situations. Just for grins try replacing with the IP address. -ralph
|
Thu, 17 Feb 2011 23:53:20 GMT |
|
 |
SMussle #12 / 12
|
 How to check for this file path?
C$ share may not be there - I think it can be removed... Steve Mussler
Quote: > Yes, have checked several times. > Probably I am overlooking something simple somewhere. > RBS
>> Asking the obvious, but have you the exact path it in a command promt? >> /Henning
>>> Thanks for the suggestions, but I can't get it to work when I have the >>> server name in the path. >>> Will do some further Googling. >>> RBS
>>>> Also beware that serverdrive has no colon(:) >>>> /Henning
>>>>> That is the path I have to deal with and it does work as I can use it >>>>> in a .bat file and no error occurs. >>>>> In any case it will give False even with the >>>>> \\servername\serverdrive\folder\file path. >>>>> RBS
>>>>>> Shouldn't the path be given as \\servername\serverdrive\folder\file ? >>>>>> /Henning
>>>>>>> From MSDN. >>>>>>> The following procedure returns true if the specified file exists >>>>>>> and false if it does not, but doesn't contain error-handling code: >>>>>>> Function FileExists (filename) As Boolean >>>>>>> FileExists = (Dir(filename) <> "") >>>>>>> End Function >>>>>>> -- >>>>>>> Steve Easton
>>>>>>>> How do I check if a file exists if the filepath is given like this: >>>>>>>> servername:serverdrive:\folder\file >>>>>>>> where server drive is the local drive name, so usually C >>>>>>>> RBS
|
Fri, 18 Feb 2011 08:45:56 GMT |
|
|