Alaska Software Inc. - Fexists test for empty directory
Username: Password:
AuthorTopic: Fexists test for empty directory
Jack DuijfFexists test for empty directory
on Thu, 06 Oct 2016 10:09:57 +0200
Hello,

I can test if a empty folder exists using Fexists( "C:\MyFolder","D")
This returs TRUE of FALSE
However, i seem to be unable to test a empty shared folder (even on same computer)

Assume C:\MyFolder is shared.
Fexists( "\\mycomputer\MyFolder","D") returns FALSE

If there is any file in this folder i can use Fexists("\\mycomputer\MyFolder\*")

How to test if a share exists if there are no files in the shared folder?
Regards
Jack Duijf

-------------------------------------------------------------
Also a member off the XXP (http://www.xxp.nl)
Wolfgang CiriackRe: Fexists test for empty directory
on Thu, 06 Oct 2016 18:44:33 +0200
Am 06.10.2016 um 10:09 schrieb Jack Duijf:
> Hello,
>
> I can test if a empty folder exists using Fexists( "C:\MyFolder","D")
> This returs TRUE of FALSE
> However, i seem to be unable to test a empty shared folder (even on same computer)
>
> Assume C:\MyFolder is shared.
> Fexists( "\\mycomputer\MyFolder","D") returns FALSE
>
> If there is any file in this folder i can use Fexists("\\mycomputer\MyFolder\*")
>
> How to test if a share exists if there are no files in the shared folder?
> Regards
> Jack Duijf
>
> -------------------------------------------------------------
> Also a member off the XXP (http://www.xxp.nl)
>
I do this with

function VerzVorhanden(pfad)
local aktlw:=CurDrive()+":"+dirname(), retw:=.F.

if dirchange(pfad)<>0
     Verzeichnis nicht vorhanden
else
    retw:=.T.
endif
dirchange(aktlw)
return retw
Andreas Gehrs-Pahl
Re: Fexists test for empty directory
on Thu, 06 Oct 2016 20:29:31 -0400
Jack,

>How to test if a share exists if there are no files in the shared folder?

I use the following function(s):

Function Dir_Exists(cDirName)
LOCAL nRet := Get_File_Attributes(ConvToAnsiCp(cDirName))
return (iif(nRet == -1, .f., nRet[5]))

Function Get_File_Attributes(cFileName)
return (DllCall("Kernel32.dll", DLL_STDCALL, "GetFileAttributesA", @cFileName))

This should work in all circumstances and on all OS versions.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC