on 02-07-2016 2:25 PM
Hi all ,
How do I check if directory is exists for the current user running ( with permissions ) ?
I do some saving to a network path with in the app and need to check first .
Thanks ,
Moshe
The DirectoryExists function will tell you if it exists. To check permissions, use FileOpen to create a dummy file. If it returns -1, you do not have permission. If the FileOpen worked, call FileClose and FileDelete.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the directory exists 'AAA':
If FileExists( 'C:\Temp\AAA\.' ) Then
Messagebox('MSG', 'Directory exists')
Else
Messagebox('MSG', 'Directory NOT exists' )
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moshe;
You could use ....
1) SDK call: Create or remove a directory - Real's PowerBuilder How-to
Note: in Real's examples, change each SDK command name from an "A" to a "W" to ensure Unicode compliance.
2) Run DOS command: RUN ("CMD /C md C:\abc")
3) Use the PFC file service: of_createdirectory in n_cst_filesrv.
4) To check for a Directory, the the command DirectoryExists
For verifying the folder's existence and the users rights, make sure you check the Directory creation return codes and use a FileOpen command and check its return code for privileges
FWIW: I would also wrap all your I/O scripts in a TRY..CATCH.
HTH
Regards ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.