how to find out if a directory exists?

guidorobben
Member Posts: 157
If I want to know it this folder exist, and the folder does not exist, I always get a error message saying that the folder does not exists. This is not what I want. I use the below method...
//Files is record.file
Files.SETRANGE(Path, 'c:\Test folder\');
exit(Files.Count>0);
//Files is record.file
Files.SETRANGE(Path, 'c:\Test folder\');
exit(Files.Count>0);
0
Comments
-
Hi,
I usually only use thsi single instruction:
IF EXISTS(path) THEN...===============
Nuno Silva0 -
This only works on Files, not on folders...Correct me if I'm wrong
Guido0 -
You can Intend make a file with :
[Ok := ] File.CREATE(Name) Typ Boolean.
If it was okay the directory where was create the File exists, if is not okay, something other happens
Yes, i have try with EXISTS Path and really seems work only with filenames.
Try make an Temp File in an Specified Folder, or Export something in a textfile. And if this runs or not decide if Folder exists.
:roll:(Oo)=*=(oO)0 -
I thought of it myself.. But there are some limitations with this approach. If I can read a folder but not write it, I have a problem. Also I have no idea how this will work in Citrix.
But i'll keep it in mind.
btw, I Think I have solved the Folder thing. Now I'm working if a Drive Exists. This is a bit harder.0 -
As an option you can create your own OCX and use it or try to find already created.0
-
You can find a folder with an automation server.
fso Automation 'Microsoft Scripting Runtime'.FileSystemObject
ok Boolean
strUrl Text
IF NOT CREATE(fso,FALSE) THEN EXIT;
strUrl := 'C:\Documents and Settings\All Users\';
ok := fso.FolderExists(strurl);
CLEAR(fso);0 -
Could Navision's File virtual table not help you out on this?I don't need PGP, my handwriting suffices.0
-
I got it as far as figuring out if folders exists. But I have a problem with the drive letter part.
guido0 -
Navision's file virtual table only supports 98 charater path names which is a serious limitation in today's world of longer folder and file names.0
-
The drives can be checked with the table Drive.. So I've don it. It works
Guido0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions