Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #13243 > unrolled thread
| Started by | aurora baccio <aurorabaccio@gmail.com> |
|---|---|
| First post | 2021-02-23 08:38 -0800 |
| Last post | 2021-02-27 09:45 +0100 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
directory exists aurora baccio <aurorabaccio@gmail.com> - 2021-02-23 08:38 -0800
Re: directory exists JohnMartens <martens@tennishulp.info> - 2021-02-23 17:54 +0100
Re: directory exists aurora baccio <aurorabaccio@gmail.com> - 2021-02-23 10:06 -0800
Re: directory exists "Wolfgang Riedmann" <wriedmann@gmail.com> - 2021-02-24 13:52 +0100
Re: directory exists Fred Killet <killet@killetsoft.de> - 2021-02-25 17:47 +0100
Re: directory exists Fred Killet <killet@killetsoft.de> - 2021-02-27 09:45 +0100
| From | aurora baccio <aurorabaccio@gmail.com> |
|---|---|
| Date | 2021-02-23 08:38 -0800 |
| Subject | directory exists |
| Message-ID | <79dc9472-ff50-4839-aaf3-6b5fb026069ao@googlegroups.com> |
good evening, I must be sure that a directory has been created. Is there a command to search like if (if the path exists) then (if the path does not exist) endif ? ? Thanks always Aurora Baccio
[toc] | [next] | [standalone]
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Date | 2021-02-23 17:54 +0100 |
| Message-ID | <s13c11$6mq$1@dont-email.me> |
| In reply to | #13243 |
Hope this can help John FUNCT IsDir( cDirectory AS STRING ) AS LOGIC LOCAL lRetVal := TRUE AS LOGIC LOCAL StruData IS _WINWIN32_FIND_DATA LOCAL nHandle AS PTR DO CASE CASE Empty(cDirectory) lRetVal := FALSE CASE ! SubStr(cDirectory,2,2) == ':\' * see if you want full path or not CASE IsDriveReady(Left(cDirectory,2)) * the drive of the path is not ready OTHERWISE lRetVal := FALSE ENDCASE * * check dir on the drive IF lRetVal IF !( Right( cDirectory, 1 ) == "\" ) cDirectory += "\" ENDIF nHandle := FindFirstFile( String2Psz( cDirectory+'*.*' ), @StruData ) IF nHandle = INVALID_HANDLE_VALUE lRetVal := FALSE ELSE CloseHandle( nHandle ) lRetVal := TRUE ENDIF ENDIF RETURN lRetVal Op 23-2-2021 om 17:38 schreef aurora baccio: > good evening, > I must be sure that a directory has been created. > Is there a command to search like if (if the path exists) then (if the path does not exist) endif ? ? > Thanks always > Aurora Baccio >
[toc] | [prev] | [next] | [standalone]
| From | aurora baccio <aurorabaccio@gmail.com> |
|---|---|
| Date | 2021-02-23 10:06 -0800 |
| Message-ID | <44329891-f918-4563-9928-f597b8d84a83o@googlegroups.com> |
| In reply to | #13244 |
Il giorno martedì 23 febbraio 2021 17:54:58 UTC+1, JohnMartens ha scritto: > Hope this can help > > John > > FUNCT IsDir( cDirectory AS STRING ) AS LOGIC > LOCAL lRetVal := TRUE AS LOGIC > LOCAL StruData IS _WINWIN32_FIND_DATA > LOCAL nHandle AS PTR > DO CASE > CASE Empty(cDirectory) > lRetVal := FALSE > CASE ! SubStr(cDirectory,2,2) == ':\' > * see if you want full path or not > CASE IsDriveReady(Left(cDirectory,2)) > * the drive of the path is not ready > OTHERWISE > lRetVal := FALSE > ENDCASE > * > * check dir on the drive > IF lRetVal > IF !( Right( cDirectory, 1 ) == "\" ) > cDirectory += "\" > ENDIF > > nHandle := FindFirstFile( String2Psz( cDirectory+'*.*' ), @StruData ) > IF nHandle = INVALID_HANDLE_VALUE > lRetVal := FALSE > ELSE > CloseHandle( nHandle ) > lRetVal := TRUE > ENDIF > ENDIF > RETURN lRetVal > > > > Op 23-2-2021 om 17:38 schreef aurora baccio: > > good evening, > > I must be sure that a directory has been created. > > Is there a command to search like if (if the path exists) then (if the path does not exist) endif ? ? > > Thanks always > > Aurora Baccio > > thanks,it works Aurora Baccio
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2021-02-24 13:52 +0100 |
| Message-ID | <i9n0ghFgneqU1@mid.individual.net> |
| In reply to | #13244 |
Or even easier: function IsDirectory( cFileName as string ) as logic local nReturn as dword if Right( cFileName, 1 ) == "\" cFileName := Left( cFileName, SLen( cFileName ) - 1 ) endif nReturn := GetFileAttributes( String2Psz( cFileName ) ) if nReturn == 0xFFFFFFFF return false endif return _And( nReturn, FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY Wolfgang JohnMartens wrote: > Hope this can help > > John > > FUNCT IsDir( cDirectory AS STRING ) AS LOGIC > LOCAL lRetVal := TRUE AS LOGIC > LOCAL StruData IS _WINWIN32_FIND_DATA > LOCAL nHandle AS PTR > DO CASE > CASE Empty(cDirectory) > lRetVal := FALSE > CASE ! SubStr(cDirectory,2,2) == ':\' > * see if you want full path or not > CASE IsDriveReady(Left(cDirectory,2)) > * the drive of the path is not ready > OTHERWISE > lRetVal := FALSE > ENDCASE > * > * check dir on the drive > IF lRetVal > IF !( Right( cDirectory, 1 ) == "\" ) > cDirectory += "\" > ENDIF > > nHandle := FindFirstFile( String2Psz( cDirectory+'*.*' ), @StruData > ) IF nHandle = INVALID_HANDLE_VALUE > lRetVal := FALSE > ELSE > CloseHandle( nHandle ) > lRetVal := TRUE > ENDIF > ENDIF > RETURN lRetVal > > > > Op 23-2-2021 om 17:38 schreef aurora baccio: > > good evening, > > I must be sure that a directory has been created. > > Is there a command to search like if (if the path exists) then (if > > the path does not exist) endif ? ? Thanks always > > Aurora Baccio > > --
[toc] | [prev] | [next] | [standalone]
| From | Fred Killet <killet@killetsoft.de> |
|---|---|
| Date | 2021-02-25 17:47 +0100 |
| Message-ID | <s18kbm$bvm$1@gwaiyur.mb-net.net> |
| In reply to | #13243 |
Function isPath(cPath) RETURN ALen(Directory(cPath + "*.*"," D")) > 0 Fred
[toc] | [prev] | [next] | [standalone]
| From | Fred Killet <killet@killetsoft.de> |
|---|---|
| Date | 2021-02-27 09:45 +0100 |
| Message-ID | <s1d0qu$okm$1@gwaiyur.mb-net.net> |
| In reply to | #13253 |
Am 25.02.2021 um 17:47 schrieb Fred Killet: > Function isPath(cPath) > RETURN ALen(Directory(cPath + "*.*"," D")) > 0 > > Fred > Funktioniert unter VO28 mit und ohne abschließenden Backshlash. Die Funktion Directory() korrigiert den Path-String offensichtlich selbstständig.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web